Upload speed inside Docker Container is limited to 4 Mbit/s

Viewed 1566

I am new to dockers and I have a docker container running for a set of students with some version-specific compilers and it's a part of a virtual laboratory setup.

Everything is fine with the setup except for the network. I have a 200 Mbps network and this is a speed test done on my phone on the same 200 Mbps network.

Speedtest on iPhone XR

I did a speed test on the host machine where the docker container is running. It is running on Ubuntu 20.04 LTS. It is all good.

speedtest on host

From inside the docker container running on the above host machine, I did a speed test with the same server ID 9898 and with an auto-selected server too.

speedtest inside container

We can see that the upload speed inside the docker container is limited to 4 Mbit/s somehow. I cannot find a reason why elsewhere.

I have seen recently that many students experienced connection drops during their attempt to connect to our SSH server. I believe this has something to do with the bandwidth limit.

The docker run command I am using to run this container build is as follows.

$ sudo docker run -p 7766:22 --detach --name lahtp-serv-3 --hostname lahtp-server --mount source=lahtp-3-storage-hdd,target=/var/lahtp-storage main:0.1

I asked a few people who suggested to run the container with net=host which will run the container with the host network instead of the docker network. I would like to know why docker container limits the upload bandwidth and how using the host network instead of the docker network fixes the issue?

Update #1:

I tried to spawn a new Ubuntu 18.04 container with the following command:

$ sudo docker run --net=host -it ubuntu:18.04 /bin/bash

Once inside the container, I installed the following to run the speedtest.

root@lahtp-server:/# apt-get update && apt-get upgrade -y && apt-get install build-essential openssh-server speedtest-cli

Once the installation is done, here is the results.

enter image description here

But adding --net=host does not change the issue. The upload speed is still 4 Mbit/s

How to remove this bandwidth throttling?

Update #2

I spawned a new Ubuntu 14.04 docker container using the following command

$ sudo docker run -it ubuntu:14.04 /bin/bash

Once the container is up, I installed the following

$ apt-get install python3-dev python3-pip
$ pip3 install speedtest-cli

And tested inside this container, and here are the results. NO THROTTLING.

enter image description here

Did the same with Ubuntu 16.04 LTS, No throttling.

$ sudo docker run -it ubuntu:16.04 /bin/bash

And once inside the container

$ apt-get install python3-dev python3-pip
$ pip3 install speedtest-cli

enter image description here NO THROTTLING.

0 Answers
Related