2

I'm following step one of this docker tutorial. I have installed ubuntu version 14.04 on a virtual box vm. I intentionally downgraded by docker version so that when I type "docker version" I get Client version: 1.5.0. This is because the server I intend to communicate with is on 1.5.0.

When trying the command "docker run hello-world" I get the response:

"Post http:///var/run/docker.sock/v1.17/containers/create: dial unix /var/run/docker.sock: permission denied. Are you trying to connect to a TLS-enabled daemon without TLS?"

When running "sudo docker run hello-world" I get the response:

Cannot connect to the Docker daemon. Is 'docker -d' running on this host?

Can someone please explain to me what's happening and how can fix it? Thanks.

Edit: I tried to follow the solution for Linux here

However,

I had tried to follow El Mesa's instructions in that post. However, when I got to running sudo docker -d I got an Error running DeviceCreate (createPool) dm_task_run failed. I don't think I need to start up a anything since I was just following the tutorial and the tutorial just did docker run hello-world immediately after installing docker

Community
  • 1
  • 1
illm
  • 197
  • 1
  • 2
  • 10
  • possible duplicate of [Am I trying to connect to a TLS-enabled daemon without TLS?](http://stackoverflow.com/questions/27528337/am-i-trying-to-connect-to-a-tls-enabled-daemon-without-tls) – nwinkler Jul 17 '15 at 08:19
  • I had tried to follow El Mesa's instructions in that post. However, when I got to running sudo docker -d I got an Error running DeviceCreate (createPool) dm_task_run failed. I don't think I need to start up a anything since I was just following the tutorial and the tutorial just did docker run hello-world immediately after installing docker. – illm Jul 17 '15 at 22:33

2 Answers2

1

Pay attention to the text that immediately preceeds Are you trying to connect to a TLS-enabled daemon without TLS in the error message. In the question asked here it is permission denied, but it could also be no such file or directory (or possibly something else). The former is more likely to mean that the current user is lacking permissions to access docker, and the latter is more likely to mean that there is a problem with the docker service itself, including the possibility that it is not running at all.

So depending on what your situation is look for the answers on this and the linked question page that focus on the respective problem area.

In my case (CentOS Linux release 7.1.1503 (Core), docker-1.7.1-108.el7.centos.x86_64) it was permission denied. I have added user to the docker group (sudo usermod -a -G docker user) but docker command still didn't work when I ran it under user, while it ran fine under sudo. What I forgot to do is log the user out and back in after adding it to the docker group, which is a step necessary for the group membership to take effect.

Restarting the machine will also solve this issue but it is a more drastic step and will work because it will imply log out / log in step. I would recommend trying to log out and back in before restarting because if it works it will give you more confidence that the group membership was the actual issue. And if it doesn't work you can always try restarting, though if it works after that it will probably work because restarting took care of some other underlying issue.

And one more thing in case you come across it and find yourself in doubt - when you first install docker and wish to add user to the docker group, you may notice (as I did in my case) that the "dockerroot" group exists but not "docker" group. Do not add user to the dockerroot group assuming that is the one you need. Instead create new docker group and add the user to it.

Community
  • 1
  • 1
0

It may be that your docker daemon is not running.

I have ubuntu/docker on a desktop with wireless LAN.

It acts a bit finicky compared to the wired computers from which docker works OK, and duplicates the error message you reported:

$ docker run -it ubuntu:latest /bin/bash
FATA[0000] Post http:///var/run/docker.sock/v1.17/containers/create: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS? 

However, after running:

sudo service docker start

It behaves correctly (at least until the host is rebooted):

$ docker run -it ubuntu:latest /bin/bash
root@2cea4e5f5028:/# 

If the system is not starting the docker daemon on boot, as was the case here, then the docker daemon can be automatically started on boot by editing /etc/rc.local to do so. Add the line below immediately before the exit line. This will fork a new bash shell, wait 30 sec for the network setup, etc., to settle, and start the docker daemon. sudo is unnecessary here because /etc/rc.local runs as root.

( sleep 30; /usr/sbin/service docker start ) &
Paul
  • 26,170
  • 12
  • 85
  • 119