32

I am trying to learn about "Docker" in ubuntu 15.04.

When I give any command using docker like "docker run image", it get the following error:

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?

I don't understand what does it mean.

David Foerster
  • 36,264
  • 56
  • 94
  • 147
  • 5
    I was getting this error message and then started the daemon with sudo service docker start. Then I was able to run sudo docker run hello-world. Good luck. – shellter May 06 '15 at 02:27

6 Answers6

38

After installing Docker you are prompted to add your user to the docker group. Simply run the command shown:

sudo usermod -aG docker $USER

You will need to close your session and log in again to have the change take effect.

Zanna
  • 70,465
Samoht
  • 381
31

There are two possible reasons why you get this error:

  1. The Docker daemon is not running. You can check that with sudo /etc/init.d/docker status.

  2. The Docker daemon is running but is configured not to listen on /var/run/docker.sock. You can check in /etc/default/docker if any -H option is specified in DOCKER_OPTS.

  • 3
    +1. I just had to use $ sudo service docker status since I got `$ sudo /etc/init.d/docker status
    • Docker is managed via upstart, try using service docker status`
    – IsaacS Jun 30 '15 at 20:50
  • After running sudo /etc/init.d/docker status, I recognized that docker service was down. I run sudo /etc/init.d/docker start, then I was able to run my docker image. – Halil Aug 28 '15 at 07:22
  • Seems /etc/default/docker not useful anymore on systemd (Ubuntu 16.04+). BTW on systemd the canonical way to check daemon status would be sudo systemctl status docker. – Pablo Bianchi Dec 01 '17 at 03:22
15

Try to reboot your os after docker was installed to apply group permissions, if your user joined docker group..

Update:

When Docker installing on ubuntu 14.04, the installer recomments what your user adds to Docker group to access Docker Service.

Look at

The docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user root and other users can access it with sudo. For this reason, docker daemon always runs as the root user. To avoid having to use sudo when you use the docker command, create a Unix group called docker and add users to it. When the docker daemon starts, it makes the ownership of the Unix socket read/writable by the docker group.

source: https://docs.docker.com/installation/ubuntulinux/#create-a-docker-group

MURATSPLAT
  • 1,801
  • 1
  • 11
  • 6
10

try to use sudo docker images to check if there is a containers called <image> in your host.

running docker run <image> will start a container called <image> in your host computer, if your host computer do not have this container, then docker will auto pull a container named '' from repository hub just like the way you running docker pull <image>. Then if it still cannot found a image called '' then it will show this error message.

you can try to replace to hello-world to see if docker is working on your computer.

sudo docker run hello-world

Also, you should check if you should use sudo.

realhu
  • 1,699
  • 2
    If the problem was that the OP is not using sudo, then the error message would have been "permission denied" instead of "no such file or directory". – Andreas Veithen May 14 '15 at 03:05
  • 1
    Yep , You are right. I tried it ,if user don't have the permission the error message would be: FATA[0000] Get http:///var/run/docker.sock/v1.18/containers/json: dial unix /var/run/docker.sock: permission denied. Are you trying to connect to a TLS-enabled daemon without TLS? – realhu May 24 '15 at 17:19
  • 2
    try to grant permissions sudo usermod -a -G docker ec2-user – A B Nov 10 '15 at 21:29
4

I found this article helpfull: https://docs.docker.com/articles/systemd/ ; I ran it on multiple environments and worked, hope it helps you too

Decebal
  • 249
2

I got a similar message while trying to pull an image. I just did the sudo su and was then able to pull the image successfully.

  • 2
    Welcome to Ask Ubuntu! I recommend [edit]ing this answer to expand it with specific details about how to do this. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on Ask Ubuntu.) Be aware though, that running Docker as super-user, has been suggest a number of times already. – David Foerster Aug 25 '15 at 10:50
  • i got the solution of my problem. – rishi kant Aug 25 '15 at 18:23