Docker守护进程启动失败:连接containerd超时,请求排查方案
Hey there, let's work through this containerd connection timeout issue you're facing with Docker 17.12.0-ce on Ubuntu 17.04. This error usually means Docker can't reach the containerd runtime it depends on, so let's go through some troubleshooting steps to get it sorted:
Check if containerd is running
Docker relies entirely on containerd to manage container lifecycles, so first verify the service status:systemctl status containerdIf it's not active, start it and set it to run automatically on boot:
systemctl start containerd systemctl enable containerdIf the service doesn't exist at all, it might be missing from your installation—we'll cover clean reinstallation later.
Verify the containerd socket exists
The error points specifically to/var/run/docker/containerd/docker-containerd.sock. Check if this file is present:ls -l /var/run/docker/containerd/docker-containerd.sockIf it's missing, check containerd's logs for startup errors that might explain why it didn't create the socket:
journalctl -u containerdLook for lines mentioning permission failures, configuration mistakes, or resource issues.
Ensure version compatibility
Docker 17.12.0-ce is designed to work with containerd versions in the 1.0.x range. If you installed containerd separately (instead of using Docker's bundled version), there might be a mismatch. For best results, stick with the containerd package that comes pre-installed with Docker—avoid mixing standalone containerd installations with Docker's runtime.Restart services in the correct order
Sometimes services get stuck in a broken state. Restart them sequentially to ensure containerd is fully initialized before Docker tries to connect:systemctl stop docker systemctl stop containerd systemctl start containerd sleep 5 systemctl start dockerThe 5-second pause gives containerd time to spin up and create the socket before Docker attempts to connect.
Fix socket permissions
The containerd socket needs to be accessible to thedockeruser group. Check its current permissions:ls -l /var/run/docker/containerd/docker-containerd.sockYou should see output like
srw-rw---- 1 root docker .... If not, adjust ownership:chown root:docker /var/run/docker/containerd/docker-containerd.sockAlso confirm your user is in the
dockergroup (to avoid needingsudofor Docker commands):groups $USERIf your user isn't listed, add yourself and log out/in to apply changes:
usermod -aG docker $USERReset containerd configuration
A misconfigured containerd setup can prevent the socket from being created properly. Reset to the default config (back up your existing config first if you have custom settings):containerd config default > /etc/containerd/config.toml systemctl restart containerdClean reinstall Docker and containerd
If all else fails, a fresh installation can fix corrupted files or mismatched dependencies:# Uninstall existing packages apt-get purge docker-ce docker-ce-cli containerd.io # Clean up residual data rm -rf /var/lib/docker rm -rf /var/lib/containerd # Reinstall Docker 17.12.0-ce apt-get update apt-get install docker-ce=17.12.0~ce-0~ubuntu-zesty docker-ce-cli=17.12.0~ce-0~ubuntu-zesty containerd.ioNote: Ubuntu 17.04 (Zesty Zapus) is end-of-life, so you may need to add Docker's legacy repository if your system can't locate the package.
Give these steps a try one by one, and let me know if any of them resolve your timeout error—or if you run into new messages we can dig into further.
内容的提问来源于stack exchange,提问作者Juan David Porras Palencia

