Closed csakaszamok closed 3 months ago
My internet speed under docker is also slow!!!
From inside docker. `docker run --rm moutten/speedtest-cli
Speedtest by Ookla
Server: Rogers - Milton, ON (id = 47540)
ISP: Bell Canada
Latency: 3.11 ms (0.48 ms jitter)
Download: 442.70 Mbps (data used: 233.7 MB ) Upload: 225.58 Mbps (data used: 270.8 MB ) Packet Loss: 0.0% Result URL: https://www.speedtest.net/result/c/2a9d37c5-b11c-4e07-8b7e-9321ac28edfd`
You may only use this Speedtest software and information generated from it for personal, non-commercial use, through a command line interface on a personal computer. Your use of this software is subject to the End User License Agreement, Terms of Use and Privacy Policy at these URLs:
https://www.speedtest.net/about/eula
https://www.speedtest.net/about/terms
https://www.speedtest.net/about/privacy
==============================================================================
Do you accept the license? [type YES to accept]: yes License acceptance recorded. Continuing.
Speedtest by Ookla
Server: Rogers - Milton, ON (id: 47540)
ISP: Bell Canada
Idle Latency: 2.79 ms (jitter: 0.69ms, low: 2.27ms, high: 3.48ms) Download: 904.62 Mbps (data used: 864.5 MB) 9.59 ms (jitter: 0.86ms, low: 3.32ms, high: 15.24ms) Upload: 922.27 Mbps (data used: 792.8 MB) 10.99 ms (jitter: 1.61ms, low: 3.77ms, high: 72.58ms) Packet Loss: 0.0% Result URL: https://www.speedtest.net/result/c/15fa0593-8e10-404e-99ae-3b2509edaec8`
Having the same issue, download speed is about 100x slower in docker containers running in WSL2 than in WSL2 itself or outside of WSL2. Upload speed is fine.
Docker container in WSL2:
/ # curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -
Retrieving speedtest.net configuration...
<stdin>:960: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
Testing from Cogent Communications (154.21.98.97)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Jonaz B.V. (Amersfoort) [52.04 km]: 19.75 ms
Testing download speed................................................................................
Download: 2.72 Mbit/s
Testing upload speed......................................................................................................
Upload: 56.62 Mbit/s
WSL2:
root@LAPTOP-DGSCLKCI# curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -
Retrieving speedtest.net configuration...
<stdin>:960: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
Testing from Cogent Communications (154.21.98.97)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Jonaz B.V. (Amersfoort) [52.04 km]: 27.273 ms
Testing download speed................................................................................
Download: 179.77 Mbit/s
Testing upload speed......................................................................................................
Upload: 56.51 Mbit/s
The issue seems to be related to the docker NAT since running the container with network host gives me reasonable speeds:
root@LAPTOP-DGSCLKCI:# docker run -it --network host python:3.12-alpine sh
/ # curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -
Retrieving speedtest.net configuration...
<stdin>:960: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
Testing from Cogent Communications (154.21.98.97)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Redhosting (Almere) [26.59 km]: 20.121 ms
Testing download speed................................................................................
Download: 170.00 Mbit/s
Testing upload speed......................................................................................................
Upload: 54.85 Mbit/s
This solution worked for me: https://github.com/microsoft/WSL/issues/4901#issuecomment-1933155508
1. in a Windows terminal, I used `ipconfig` to find the interface name of my WIFI adapter. "Wi-Fi 2" in my case. 2. In a windows terminal I ran with the administrator privilege, I typed the command `netsh int ipv4 set interface "Wi-Fi 2" forwarding=enable`. The response is `OK.`.
Windows Version
Microsoft Windows [Version 10.0.22621.1702]
WSL Version
1.2.5.0
Are you using WSL 1 or WSL 2?
Kernel Version
Linux version 5.15.90.1-microsoft-standard-WSL2 (oe-user@oe-host) (x86_64-msft-linux-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.34.0.20200220)
Distro Version
Ubuntu 22.04
Other Software
Docker desktop windows 4.19.0 (106363)
Repro Steps
check speed in docker:
docker run --rm -it ubuntu bash -c "apt update ; apt install -y speedtest-cli ; speedtest-cli"
check speed:
apt update ; apt install -y speedtest-cli ; speedtest-cli
1) in wsl check speed 2) install latest native docker under wsl and check speed in docker 3) uninstall docker from wsl then install latest docker desktop and check speed in docker
Expected Behavior
on my host the internet speed is about 250 Mbit/s so I would like to hapy to see above speed in docker containers even if I use native docker under wsl
Actual Behavior
1) wsl: the speed is 249 Mbit/s -> ok 2) native docker in wsl: 5 Mbit/s -> it's not ok ! 3) docker desktop: 249 Mbit/s, ok
Diagnostic Logs
No response