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.

1
  • 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 6, 2015 at 2:27

6 Answers 6

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.

4
  • probably the simplest. I don't know if it works, though (used @decebal's) answer.
    – Yair Daon
    Jul 14, 2015 at 4:15
  • I did not get this prompt. I am on Raspberry Pi. Feb 3, 2017 at 22:00
  • To add yourself to the docker group later, run sudo usermod -a -G docker <user>. See here for more info.
    – Hugh W
    Mar 20, 2017 at 12:43
  • On Ubuntu 18.04 with Gnome, I had to restart the system for this to work. Just logging out and back in didn't work :/
    – Zoltán
    Jun 11, 2018 at 11:33
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
  • 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, 2015 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, 2015 at 7: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. Dec 1, 2017 at 3: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

5
  • 2
    You should explain why this will help.
    – guntbert
    Aug 10, 2015 at 21:00
  • 1
    @guntbert I have update my answer..
    – MURATSPLAT
    Aug 11, 2015 at 13:55
  • @MURATSPLAT, qbi, gunbert Thanks i find the solution
    – rishi kant
    Aug 25, 2015 at 18:25
  • To make group permission change effect. You don't need to reboot. logout is enough.
    – Tim Wu
    Mar 17, 2017 at 23:53
  • @TimWu On Ubuntu 18.04 with Gnome, I had to restart the system - just logging out and back in didn't work :/
    – Zoltán
    Jun 11, 2018 at 11:34
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.

3
  • 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". May 14, 2015 at 3: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, 2015 at 17:19
  • 2
    try to grant permissions sudo usermod -a -G docker ec2-user
    – A B
    Nov 10, 2015 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

3
  • Link-only answers are not considered acceptable. Please flesh out your answer to be complete.
    – Flimzy
    Aug 16, 2015 at 3:00
  • 2
    Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
    – Mitch
    Aug 16, 2015 at 7:25
  • 1
    That systemd link appears to be dead. Here's another link docs.docker.com/engine/admin/systemd
    – wsams
    Mar 15, 2017 at 18:04
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
  • 2
    Welcome to Ask Ubuntu! I recommend editing 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. Aug 25, 2015 at 10:50
  • i got the solution of my problem.
    – rishi kant
    Aug 25, 2015 at 18:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .