Windows Ubuntu子系统Docker守护进程连接失败问题求助
Let’s walk through the most reliable fixes for this common Docker issue— I’ve dealt with this plenty of times, so these steps should get you sorted:
1. Verify the Docker daemon is running
First, check if the Docker service is actually active:
- For systemd-based systems (most modern Linux distros like Ubuntu 16.04+):
systemctl status docker - For older sysvinit systems:
service docker status
If the service isn't running, start it immediately:
# Systemd systemctl start docker # Sysvinit service docker start
To avoid this issue on reboot, enable the service to start automatically:
systemctl enable docker
2. Ensure your user has Docker group permissions
By default, only the root user and users in the docker group can access the Docker socket. Check if your user is part of the group:
groups
If you don’t see docker in the output, add your user to the group:
usermod -aG docker $USER
You’ll need to log out and log back in for this change to take effect, or run newgrp docker to apply it temporarily in your current session.
3. Check permissions on the Docker socket
Sometimes the /var/run/docker.sock file has incorrect permissions. Verify them with:
ls -l /var/run/docker.sock
The output should show ownership as root:docker. If not, adjust the permissions:
chown root:docker /var/run/docker.sock chmod 660 /var/run/docker.sock
4. Restart the Docker service
If the daemon is running but unresponsive, a restart often fixes glitches:
# Systemd systemctl restart docker # Sysvinit service docker restart
After restarting, test with docker ps again.
5. Special fix for WSL (Windows Subsystem for Linux)
Since your hostname is DESKTOP-51NFMIM, you’re likely running Docker in WSL. Here’s what to check:
- Open Docker Desktop on Windows, go to Settings > Resources > WSL Integration
- Make sure the WSL distribution you’re using (e.g., Ubuntu) is enabled
- Restart Docker Desktop and your WSL terminal, then try
docker psagain
内容的提问来源于stack exchange,提问作者Zakaria Shahed

