Can't start Docker Engine on wsl2
Description
WSL version:
WSL version: 2.5.1.0
Kernel version: 6.6.75.1-1
WSLg version: 1.0.66
MSRDC version: 1.2.5716
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.26100.3476
Reproduce
- open Docker Desktop
- hang on to Engine Starting a long time
- error occurred
Expected behavior
normal start
docker version
Client:
Version: 28.0.1
API version: 1.48
Go version: go1.23.6
Git commit: 068a01e
Built: Wed Feb 26 10:41:52 2025
OS/Arch: windows/amd64
Context: desktop-linux
error during connect: Get "http://%2F%2F.%2Fpipe%2FdockerDesktopLinuxEngine/v1.48/version": open //./pipe/dockerDesktopLinuxEngine: The system cannot find the file specified.
docker info
Client:
Version: 28.0.1
Context: desktop-linux
Debug Mode: false
Plugins:
ai: Docker AI Agent - Ask Gordon (Docker Inc.)
Version: v0.9.4
Path: C:\Users\Cayin\.docker\cli-plugins\docker-ai.exe
buildx: Docker Buildx (Docker Inc.)
Version: v0.21.1-desktop.2
Path: C:\Users\Cayin\.docker\cli-plugins\docker-buildx.exe
compose: Docker Compose (Docker Inc.)
Version: v2.33.1-desktop.1
Path: C:\Users\Cayin\.docker\cli-plugins\docker-compose.exe
debug: Get a shell into any image or container (Docker Inc.)
Version: 0.0.38
Path: C:\Users\Cayin\.docker\cli-plugins\docker-debug.exe
desktop: Docker Desktop commands (Beta) (Docker Inc.)
Version: v0.1.5
Path: C:\Users\Cayin\.docker\cli-plugins\docker-desktop.exe
dev: Docker Dev Environments (Docker Inc.)
Version: v0.1.2
Path: C:\Users\Cayin\.docker\cli-plugins\docker-dev.exe
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.27
Path: C:\Users\Cayin\.docker\cli-plugins\docker-extension.exe
feedback: Provide feedback, right in your terminal! (Docker Inc.)
Version: v1.0.5
Path: C:\Users\Cayin\.docker\cli-plugins\docker-feedback.exe
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.4.0
Path: C:\Users\Cayin\.docker\cli-plugins\docker-init.exe
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: C:\Users\Cayin\.docker\cli-plugins\docker-sbom.exe
scout: Docker Scout (Docker Inc.)
Version: v1.16.3
Path: C:\Users\Cayin\.docker\cli-plugins\docker-scout.exe
Server:
ERROR: error during connect: Get "http://%2F%2F.%2Fpipe%2FdockerDesktopLinuxEngine/v1.48/info": open //./pipe/dockerDesktopLinuxEngine: The system cannot find the file specified.
errors pretty printing info
Diagnostics ID
B90C0737-CB86-4516-AEFD-A98DBD11CA83/20250319062602
Additional Info
No response
Did you use a proxy?
Did you use a proxy?
yes
❯ echo $HTTP_PROXY
http://127.0.0.1:7890
❯ echo $HTTPS_PROXY
http://127.0.0.1:7890
When I switched WSL to mirrored mode, Docker Desktop couldn't launch.
.wslconfig
[wsl2]
networkingMode=mirrored
firewall=false
[experimental]
autoMemoryReclaim=gradual
sparseVhd=true
hostAddressLoopback=true
- Abnormal information:
running engine: waiting for the Docker API: context deadline exceeded
- Diagnostics ID
71DD2F76-F710-49C4-A081-F0FFED4A5A11/20250319065650
- Solution
Add *.docker.internal to NO_PROXY. This can be configured in the proxy software.
The image cannot be pulled.
- Abnormal information for
docker pull nginx.
Using default tag: latest
Error response from daemon: Get "https://registry-1.docker.io/v2/": proxyconnect tcp: dial tcp 127.0.0.1:1080: connect: connection refused
- Testing with
curl:
$ curl -x http://127.0.0.1:1080 https://www.google.com
# Normal response.
$ curl -x http://127.0.0.1:1080 https://registry-1.docker.io/v2/
# Response: {"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":null}]}
- Attempted fix:
Tried starting the container before configuring the proxy.
Goal: Docker Desktop should correctly use the system proxy.
In previous Docker versions, this configuration worked fine though
# .wslconfig
[wsl2]
networkingMode=mirrored
dnsTunneling=true
firewall=true
autoProxy=true
[experimental]
# requires dnsTunneling but are also OPTIONAL
bestEffortDnsParsing=true
#useWindowsDnsCache=true
- Solution Add *.docker.internal to NO_PROXY. This can be configured in the proxy software.
❯ curl -iv gateway.docker.internal
* Uses proxy env variable no_proxy == 'kubernetes.docker.internal,gateway.docker.internal,host.docker.internal,192.168.*,172.31.*,172.30.*,172.29.*,172.28.*,172.27.*,172.26.*,172.25.*,172.24.*,172.23.*,172.22.*,172.21.*,172.20.*,172.19.*,172.18.*,172.17.*,172.16.*,10.*,127.*,localhost,<local>'
* Host gateway.docker.internal:80 was resolved.
* IPv6: (none)
* IPv4: 192.168.101.14
* Trying 192.168.101.14:80...
* connect to 192.168.101.14 port 80 from 192.168.101.14 port 43944 failed: Connection refused
The method to bypass the proxy, I tried it, but it didn’t work in my case—still unable to start the Engine.
Have Similar Issue
My .wslconfig
[wsl2]
#dnsTunneling = true
# AI told me to do this and it does not work
# 2025-03-09 - JMK Does not work
# networkingMode=bridged
# vmSwitch=WSL2Switch
networkingMode=mirrored
dnsTunneling=true
autoProxy=true
ipv6=false
My Docker Desktop error
running engine: waiting for the Docker API: context deadline exceeded
My Diagnostics ID
D52409E8-E4E4-41A6-A570-738924E0BEEB/20250319183623
It looks like my previous podman config is conflicting with the docker config
docker info Client: Docker Engine - Community Version: 25.0.4 Context: default Debug Mode: false Plugins: buildx: Docker Buildx (Docker Inc.) Version: v0.13.0 Path: /usr/libexec/docker/cli-plugins/docker-buildx compose: Docker Compose (Docker Inc.) Version: v2.24.7 Path: /usr/libexec/docker/cli-plugins/docker-compose
ERROR: permission denied while trying to connect to the Docker daemon socket at unix:///run/podman/podman.sock: Get "http://%2Frun%2Fpodman%2Fpodman.sock/v1.44/info": dial unix /run/podman/podman.sock: connect: permission denied errors pretty printing info
Since it seems there is no easy way to make both work together ( podman and docker desktop) I have disabled docker with:
sudo systemctl disable docker
@jkruebbe
ERROR: permission denied while trying to connect to the Docker daemon socket at unix:///run/podman/podman.sock: Get "http://%2Frun%2Fpodman%2Fpodman.sock/v1.44/info": dial unix /run/podman/podman.sock: connect: permission denied errors pretty printing info
It seems like a Unix socket file permissions issue. You can modify the Podman socket permissions or adjust the user group settings.
I also have the same issue, I'm also using a proxy
However, it was found that if the network mode of WSL changed to an option other than mirrored, this problem can be avoided
Have the same problem. NAT and VirtioProxy will start docker engine but Mirrored won't.
Also start failed with a TUN adaptor.
- Solution
Add *.docker.internal to NO_PROXY. This can be configured in the proxy software.
In my case, this way worked.
Here I try to put down some ways I used to resolve the problem which is when using proxy that docker desktop is always starting.
My system environment:
- proxy tool:
clash verge - os:
windows 11 - docker desktop version:
v4.39.0 - WSL integration:
Ubuntu-24.04 - my
.wslconfigcontent:[experimental] networkingMode=mirrored dnsTunneling=true firewall=true autoProxy=true hostAddressLoopback=true
Option 1. start docker desktop before clash starting, then docker desktop will started successfully.
Option 2. click switch to windows containters... , but there docker will cant be used on WSL, and no Resource -> Advanced in Settings.
Option 3. Configure *.docker.internal to bypass the proxy in the proxy tool. Example:
@yzztin
It's unrelated to the HTTP proxy; internal communication uses a pipe. To launch it on WSL, simply change mirrored to nat. Mirrored mode currently has a bug, and the official patch hasn’t been released yet.