Ubuntu 16.04安装Docker CE后无法连接守护进程及文件缺失问题
Hey there, let's tackle your two linked issues together—they both stem from the same root cause: the Docker daemon isn't running. Here's how to fix it step by step:
1. Check if the Docker Daemon is Active
First, verify the status of the Docker service with this command:
systemctl status docker
If you see output saying inactive (dead) or similar, that's the core problem.
2. Start the Docker Daemon
Launch the Docker service manually:
sudo systemctl start docker
To avoid hitting this issue after server reboots, set the service to start automatically on boot:
sudo systemctl enable docker
3. Verify the /var/lib/docker Directory Exists
Once the daemon is up and running, the /var/lib/docker directory will be created automatically—it’s where Docker stores all images, containers, volumes, and system data. Check for it with:
ls -la /var/lib/docker
You should now see subdirectories like containers, images, and volumes listed here.
4. Test Running Your Ubuntu Container
Now try your original command again:
docker run -it ubuntu
This will pull the Ubuntu base image (if you don’t already have it) and drop you into an interactive shell inside the container—no more connection errors.
If the Daemon Fails to Start
If starting the service throws an error, check the Docker logs to diagnose what’s wrong:
journalctl -u docker.service
Look for lines marked ERROR—common issues include misconfigured Docker settings, permission conflicts, or clashes with other system services.
内容的提问来源于stack exchange,提问作者Hassine H'maied

