Description of problem:
After install docker by running curl -sSL https://test.docker.com/ | sh
, and DOCKER_HOST
environment variable is not set in my shell, run docker cmd, but return :
$ docker ps
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
$ service docker status
docker start/running, process 28966
docker version
:
Client:
Version: 1.9.0-rc5
API version: 1.21
Go version: go1.4.2
Git commit: 9318004
Built: Tue Nov 3 05:59:27 UTC 2015
OS/Arch: linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
docker info
:
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
uname -a
:
Linux docker 3.13.0-43-generic #72-Ubuntu SMP Mon Dec 8 19:35:06 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Environment details (AWS, VirtualBox, physical, etc.):OpenStack Cloud instance
Actual Results: docker daemon cannot work
Expected Results: docker daemon can work Ok
Could you please try running
sudo su -
service docker start
docker images
See if that works. And if it does, please add your user to the docker user group like this =>
sudo usermod -aG docker <username>
_Edit_: You might have to log out and than back in again for it to take effect.
@Skarlso , I did "sudo usermod -aG docker ubuntu" , but not log out and back in to take effect.
Thanks, :smile:
Hah, I couldn't count on one hand how many times that happened to me as well. :D :+1:
To anyone who stumbles across this issue in the future.
I just spent a bit of time debugging this issue in a few of my servers. I now realize ssh ControlPersist multiplexing makes the whole 'log out log back in' thing not work the way you think it does. It makes sense why this happens, I just never thought about it happening like this before.
To fix this
$ ssh -O check -S ~/.ssh/[email protected] server.com
Master running (pid=14920)
$ ssh -O stop -S ~/.ssh/[email protected] server.com
Stop listening request sent.
Then log back into your server.
I'm having the same problem but neither of the solutions provided worked.
service docker status
Redirecting to /bin/systemctl status docker.service
โ docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2015-12-16 18:19:56 EST; 17h ago
Docs: https://docs.docker.com
Main PID: 5181 (docker)
Memory: 2.3M
CGroup: /system.slice/docker.service
โโ5181 /usr/bin/docker daemon -H fd://
When I try to execute other commands, it shows "cannot connect to the docker daemon"
# docker version
Client:
Version: 1.9.1
API version: 1.21
Go version: go1.4.2
Git commit: a34a1d5
Built: Fri Nov 20 13:25:01 UTC 2015
OS/Arch: linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
Has any one tried other troubleshooting? I'm running redhat/softlayer.
BTW, It was running hello-world fine, but now after following the above troubleshooting, it's showing the error when I try hello-world as well.
Solved by manually starting the daemon. For some reason, the service is not actually starting it.
ran docker daemon &
and now it's working fine. will have to investigate further to see why the service is not fully starting it.
We got exactly the same issue. Also for us "/usr/boin/docker -d" worked but we'd much prefer to be fixed when restarting via upstart.
On Fedora 22
Installing Docker:
$> curl -fsSL https://get.docker.com/ | sh
After installing Docker:
A user needs to be added to the docker group.
$> sudo usermod -aG docker
The docker daemon needs to be started
$> sudo service docker start
You can set the daemon to start at boot
$> sudo chkconfig docker on
You can verify the docker service is running
$> service docker status
And one last final check
$> docker run hello-world
The issue is neatly documented in Docker Documentation.
My environment:
VirtualBox
OS: CentOS-7 -x86_64-Minimal
After adding user to the group, execute the following command.
sudo chkconfig docker on
At first, I couldn't view the server config details on the execution of docker version
, and I received the same error "Cannot connect to the Docker daemon. Is the docker daemon running on this host?"
After executing sudo chkconfig docker on
, everything works super fine :)
On the latest Arch Linux, the only way I can get docker to work is to
sudo systemctl stop docker
sudo docker daemon &
Then it works appropriately.
After it is started by systemctl
, I see this in the process list:
root 1933 0.0 0.1 360524 11748 ? Ssl 08:47 0:00 docker-containerd -l /var/run/docker/libcontainerd/docker-containerd.sock --runtime docker-runc
When I run it manually, I see:
root 2307 1.7 0.5 604268 34520 pts/0 Sl 08:56 0:00 docker daemon
root 2313 0.2 0.2 221256 12112 ? Ssl 08:56 0:00 docker-containerd -l /var/run/docker/libcontainerd/docker-containerd.sock --runtime docker-runc
@hopeseekr was that an upgrade from an existing installation, or a fresh install? Anything in the logs? Any modifications you made to the systemd unit file?
Fresh install on a new Arch Linux install that I setup yesterday. I don't see any docker-specific log files in /var/log
.
I actually absolutely hate systemd, and I have NO IDEA how to debug or even look at what commands a systemd service actually runs. God! I miss OpenRC so much!
@hopeseekr haha ๐
you can probably get some information from sudo systemctl status docker
and journalctl -xe -u docker
. Did you use the package from our apt repositories or the arch-linux repos?
Yes, I used the official packman -S docker
route.
After a fresh reboot:
โ docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabl
Active: active (running) since Tue 2016-05-24 09:28:34 CDT; 12s ago
Docs: https://docs.docker.com
Main PID: 7302 (docker)
Tasks: 19 (limit: 512)
Memory: 15.4M
CPU: 134ms
CGroup: /system.slice/docker.service
โโ7302 /usr/bin/docker daemon -H fd://
โโ7308 docker-containerd -l /var/run/docker/libcontainerd/docker-containerd.so
May 24 09:28:34 libran docker[7302]: time="2016-05-24T09:28:34.277017655-05:00" level=info msg="[graphdriver] using prior storage driver \"btrfs\""
May 24 09:28:34 libran docker[7302]: time="2016-05-24T09:28:34.289658653-05:00" level=info msg="Graph migration to content-addressability took 0.00 seconds"
May 24 09:28:34 libran docker[7302]: time="2016-05-24T09:28:34.295186622-05:00" level=info msg="Firewalld running: false"
May 24 09:28:34 libran docker[7302]: time="2016-05-24T09:28:34.341449086-05:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address"
May 24 09:28:34 libran docker[7302]: time="2016-05-24T09:28:34.388887470-05:00" level=info msg="Loading containers: start."
May 24 09:28:34 libran docker[7302]: time="2016-05-24T09:28:34.389074804-05:00" level=info msg="Loading containers: done."
May 24 09:28:34 libran docker[7302]: time="2016-05-24T09:28:34.389156085-05:00" level=info msg="Daemon has completed initialization"
May 24 09:28:34 libran docker[7302]: time="2016-05-24T09:28:34.389239746-05:00" level=info msg="Docker daemon" commit=5604cbe graphdriver=btrfs version=1.11.1
May 24 09:28:34 libran docker[7302]: time="2016-05-24T09:28:34.393658963-05:00" level=info msg="API listen on 0.0.0.0:2375"
May 24 09:28:34 libran systemd[1]: Started Docker Application Container Engine.
journalctl:
-- Subject: Unit docker.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has begun starting up.
May 24 09:28:33 libran docker[7302]: time="2016-05-24T09:28:33.271562128-05:00" level=inf
May 24 09:28:34 libran docker[7302]: time="2016-05-24T09:28:34.277017655-05:00" level=inf
May 24 09:28:34 libran docker[7302]: time="2016-05-24T09:28:34.289658653-05:00" level=inf
May 24 09:28:34 libran docker[7302]: time="2016-05-24T09:28:34.295186622-05:00" level=inf
May 24 09:28:34 libran docker[7302]: time="2016-05-24T09:28:34.341449086-05:00" level=inf
May 24 09:28:34 libran docker[7302]: time="2016-05-24T09:28:34.388887470-05:00" level=inf
May 24 09:28:34 libran docker[7302]: time="2016-05-24T09:28:34.389074804-05:00" level=inf
May 24 09:28:34 libran docker[7302]: time="2016-05-24T09:28:34.389156085-05:00" level=inf
May 24 09:28:34 libran docker[7302]: time="2016-05-24T09:28:34.389239746-05:00" level=inf
May 24 09:28:34 libran docker[7302]: time="2016-05-24T09:28:34.393658963-05:00" level=inf
May 24 09:28:34 libran systemd[1]: Started Docker Application Container Engine.
-- Subject: Unit docker.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has finished starting up.
--
-- The start-up result is done.
Netstat reports: tcp 0 0 0.0.0.0:2375 0.0.0.0:* LISTEN 1/init
But docker keeps saying:
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
So then I run sudo killall -9 docker
and then sudo docker daemon &
, and the command shows:
WARN[0000] containerd: low RLIMIT_NOFILE changing to max current=1024 max=4096
INFO[0001] [graphdriver] using prior storage driver "btrfs"
INFO[0001] Graph migration to content-addressability took 0.00 seconds
INFO[0001] Firewalld running: false
INFO[0001] Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address
INFO[0001] Loading containers: start.
INFO[0001] Loading containers: done.
INFO[0001] Daemon has completed initialization
INFO[0001] Docker daemon commit=5604cbe graphdriver=btrfs version=1.11.1
INFO[0001] API listen on /var/run/docker.sock
and then it works correctly.
[tsmith@libran ~]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
namespace/project latest 74941504eebb 5 weeks ago 1.156 GB
Yes, I used the official packman -S docker route.
Yes, those are packages maintained and supported by arch linux; it's possible that they ship with different options and configuration.
From the output you gave, it looks like there's something incorrectly set in the systemd unit-file, or there's a daemon.json
present somewhere; the daemon that's started through systemd is listening on 0.0.0.0:2375;
API listen on 0.0.0.0:2375
(note that that is a _dangerous_ configuration, if your host is accessible from the internet; it gives unprotected access to the API through port 2375 of your computer)
When you start it manually, it's using the defaults, and correctly listening on a local socket only;
INFO[0001] API listen on /var/run/docker.sock
So;
For ubuntu 14.04 on virtual box vm with docker installation
sudo groupadd docker
sudo gpasswd -a ${USER} docker
sudo service docker restart
Now, restart the OS. This solution is well explained here
https://jee-appy.blogspot.com/2016/02/installing-docker-in-virtual-box.html
I experiment the same issue on Ubuntu Xenial (and on the previous version on ubuntu). Although the daemon is running, I cannot connect to it with my regular user (which is part of the docker group). Sometimes I restart, and it magically works! No idea why....
I got same issue on Cent OS 7 which I installed docker by yum. I tried all @xecronix mentioned here but still can't fix it.
At last I found I should run docker after sudo. The hint doesn't mean docker daemon isn't running...
I got the same issue in CentOS Linux release 7.2.1511 (Core) which I installed by "curl -sSL https://get.docker.com/ | sh". I tried "sudo docker daemon &", and the issue is fixed.
In my case, if I check:
sudo service docker status
I can see the daemon is running, but I can still see the message: "_Cannot connect to the Docker daemon. Is the docker daemon running on this host?_" Running :
sudo service docker restart
Apparently solves the problem (I don't know why).
On ubuntu 14.04 for me workaround is not simply run docker (not service, but client) as sudo. Before run "docker run --rm busybox true", for example, move to sudo bash by typing "sudo su". In sudo bash docker is working fine.
Apparently, adding user to docker group will have a similar effect and in this case run bash as sudo is not necessary.
fully restart the os, not just logging out and back in. was the solution for me.
The use group changes doesn't apply immediately when a user is added in a group (the user need to log off and log on again for the changes to apply), but it is better to just restart the OS.
@dandv Done.
@wenchma: can you please correct the typo in the title of this issue, so searches can find it more easily? Also, "but not log out and back in to take effect." -> "but had to log out and back in."
No problem man. :-) glad I could help out folks. :-)
On my latest Mac OSX Sierra,
I also got the error, after I install Docker Toolbox, when I run docker on my terminal:
git:(master) โ docker version
Client:
Version: 1.12.2
API version: 1.24
Go version: go1.6.3
Git commit: bb80604
Built: Tue Oct 11 17:00:50 2016
OS/Arch: darwin/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
Based on the number of people giving a thumbs up to @Skarlso's comment about
sudo usermod -aG docker <username>
maybe there should be check for that so you could say:
You need to be in the 'docker' group
instead of the misleading advice
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
@johshoff docker 1.13 will give a more informative error message if the client fails to connect due to permissions error; see this pull request; https://github.com/docker/docker/pull/26797
I get on my AWS instance following stuff when I try to start Docker service
time="2017-02-01T12:34:46.999769865Z" level=info msg="libcontainerd: new containerd process, pid: 2737"
time="2017-02-01T12:34:48.004600950Z" level=fatal msg="Error starting daemon: error initializing graphdriver: devicemapper: Non existing device docker-docker--pool"
What should I do then?
P.S. Full log
@Suncatcher This Issues is closed. If you have a problem, please open a new one.
Dear all, just in case this would happen to solve you issue ...
I did all the abode, but only running docker daemon in interactive mode solved my problem.
When running the daemon like this, I got the missing information:
Error starting daemon: error initializing graphdriver: /var/lib/docker contains several valid graphdrivers: aufs, devicemapper; Please cleanup or explicitly choose storage driver (-s
)
Previously I was using the old docker from Ubuntu 14.04 and upgraded it using the official upstream docker repository...
After specifying the correct devince mapper (aufs) a lot of checks were performed for existing images and everything was fine afterwards.
I hope this will help others :-)
@DrST
What means _running docker daemon in interactive mode_?
Could you please describe the exact steps you did?
Should we fix the typo in the issue name? *Failed
Should we fix the typo in the issue name? *Failed
Definitely!
There underlying problem is the docker group isn't created ; so a usermod -G user docker will also fail
Dunno where the problem is, but on standard Amazon linux Docker is installable like a charm, so I recommend to use standard.
But to ship ECS-optimized Linux AMI (yes-yes, pay attention to these letters - it's container-optimized) without ability to being configured for Docker is a bullshit! It's simply a shit!
*ucking Amazon is trying to make money from nowhere and it's frustrating.
Why the hell I have to be a DevOps-level to simply use Docker? They make me to buy their paid support plan, I see no other reason.
Had the same issue in AWS-hosted Archlinux.
Fixed via:
pacaur -S docker-machine
docker-machine env default
sudo systemctl start docker
centos 6.6 ,docker 1.7.1
> yum install device-mapper-event-libs
> sudo service docker restart
it's worked for me
I had the same problem on Arch Linux (Docker package version: 1:17.03.1-1). I modified this on /usr/lib/systemd/system/docker.service
and I got it working fine after that.
#ExecStart=/usr/bin/dockerd -H fd://
ExecStart=/usr/bin/dockerd
Just follow below steps to resolve the issue.
$:sudo groupadd docker
$:sudo gpasswd -a ${USER} docker
$:sudo service docker restart
$:newgrp docker
Thank you RakeshMsr.
You save my hard working and day.
any other fixes? none of this working for me.
Type:
$: dockerd
If you see a message: "Please upgrade your kernel to 3.10.0 or newer.", upgrade your linux kernel.
Most helpful comment
Could you please try running
See if that works. And if it does, please add your user to the docker user group like this =>
_Edit_: You might have to log out and than back in again for it to take effect.