I am getting an error message saying I can't connect to the docker daemon. I have looked into other people's answers who have had similar issues but it hasn't helped. I am running the version of Ubuntu 15.10. I will try to provide all the info I have.
root@# docker-compose -f docker-compose-deps.yml up -d
ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
Docker Version
root@# sudo docker version
Client:
Version: 1.9.1
API version: 1.21
Go version: go1.4.2
Git commit: a34a1d5
Built: Fri Nov 20 13:20:08 UTC 2015
OS/Arch: linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
Docker-Compose Version
root@# docker-compose --version
docker-compose version 1.5.2, build 7240ff3
This is what happens if I try to stop or start the service...
root@# sudo service docker stop
stop: Unknown instance:
root@# sudo service docker start
docker start/running, process 5375
If I run ps aux | grep docker
root@# ps aux | grep docker
root 4233 0.0 0.0 13692 2204 pts/15 S+ 10:27 0:00 grep --color=auto docker
Any help would be greatly appreciated. Let me know if you may need anymore information.
I had the same issue. After taking notes and analyzing some debugging results, finally, I solved what can be the same error. Start the service first,
service docker start
Don't forget to include your user to the docker group.
From the output of "ps aux | grep docker", it looks like docker daemon is not running. Try using below methods to see what is wrong and why docker is not starting
$ sudo tail -f /var/log/upstart/docker.log
$ sudo docker -d -D
It appears your issue was created by an old Docker bug, where the socket file was not recreated after Docker crashed. If this is the issue, then renaming the socket file should allow it to be re-created:
Since this bug is fixed, most people getting the error
Couldn't connect to Docker daemon
are probably getting it because they are not in thedocker
group and don't have permissions to read that file. Running withsudo docker ...
will fix that, but isn't a great solution.Docker can be run as a non-root user (without
sudo
) that has the proper group permissions. The Linux post-install docs has the details. The short version:This allows users in the
docker
group to rundocker
anddocker-compose
commands withoutsudo
. Docker itself runs a root, allowing some attacks, so you still need to be careful with what containers you run. See Docker Security Documentation for more details.