You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows Ubuntu子系统Docker守护进程连接失败问题求助

Fixing "Cannot connect to the Docker daemon at unix:///var/run/docker.sock" Error

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 ps again

内容的提问来源于stack exchange,提问作者Zakaria Shahed

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 06:43:38