/var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
Asked Answered
R

6

29

I am very new to the docker when try to run docker info it gives me following error.

$ docker info
FATA[0000] Get http:///var/run/docker.sock/v1.17/info: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS? 

I am using ubuntu 14.04. I followed the installation istructions mentioned on https://docs.docker.com/installation/ubuntulinux/#installing-docker-on-ubuntu

But I'm still getting the error. How can I fix this?

Ruelas answered 30/3, 2015 at 14:38 Comment(2)
Did you try $ sudo docker info?Inimitable
it is handy to have 2 aliases alias docker="sudo docker.io" and complete -F _docker docker (the last one in order to keep autocompletion)Dilemma
R
45

This error occurred because I didn't restart my computer after installing docker. Now the above command is working for me.

Ruelas answered 31/3, 2015 at 4:52 Comment(5)
Instructions told me to log off, not reboot. I tried that. Maybe I should try rebooting.Renfro
Yup, you have to reboot, in spite of what the directions (don't) say, at least on Ubuntu 14.04..Renfro
@Ruelas Any ideas on how to fix it on a CI stateless environment were restarting is not an option? (currently using Ubuntu 12.04 LTS)Shadowy
You don't have to reboot... For reasons best known to docker the docker service does not start automatically when installed. As such, In Ubuntu 14.04 sudo service docker start did the trick for meSubservience
While restarting might work it's good to check if the daemon is running or not. See my answer for more.Solecism
F
20

This is because the docker service is not automatically started after an install.

You can start the docker service in Ubuntu and its derivatives (looking at you Linux Mint) by typing:

sudo service docker start

To check that docker started, this file should exist:

ls -la /var/run/docker.sock
Fill answered 29/7, 2015 at 18:31 Comment(1)
I had the same problem when docker service was already running. I did sudo service docker restart and everything turned fine.Burnout
S
14

I had a similar issue, restarting didn't work. Running docker -d gave me a different error

Error loading docker apparmor profile: exec: "/sbin/apparmor_parser": stat /sbin/apparmor_parser: no such file or directory ()

and ran

 sudo apt-get install apparmor 

to fix the apparmor error

My guess the daemon didn't get started automatically post-install because of the apparmor error. (Your error might be different)

Env: Linux Mint 17.1

Update: Also make sure the user you are using is in the docker group

Solecism answered 22/4, 2015 at 11:57 Comment(4)
After installing apparmor, docker -d worked, but docker info still show that error.Prase
Do you see docker running? Run "ps -ef | grep docker" or "cat /var/run/docker.pid" to find the pid. When I get this error I kill the process and let it respawn a new process.Solecism
Didn't worked at first. Then I tried it with sudo and it worked (also Linux Mint). I'm not sure however if doing it with sudo is a good practice. Would appreciate if someone more knowledgeable shed some light on this.Phrenetic
The user should be in docker group if I remember right don't have a docker install right now I can look into.Solecism
Y
3

I had the same problem. I needed add my user to docker group (on /etc/group or uses sudo gpasswd -a user docker - and restarting the session.

OS: Ubuntu 14.04.2 LTS 3.13.0-57-generic x64

Ye answered 26/6, 2015 at 20:34 Comment(0)
S
1

After starting docker. change the owner file with this command:

sudo chown [user]:docker /var/run/docker.sock

if your problem didn't solve after it.

sudo mkdir -p /etc/systemd/system/docker.service.d

then

sudo vim /etc/systemd/system/docker.service.d/options.conf

add this line to options.conf file

[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H unix:// -H tcp://0.0.0.0:2375
Sesquicentennial answered 12/4, 2022 at 8:22 Comment(0)
M
1

If

sudo service docker start

isn't working cause you're a different Linux OS (another distro than ubuntu/debian-based): you can use the following command:

sudo systemctl status docker

If the status says that docker isn't loaded, you can continue the following:

sudo systemctl start docker

[or restart (instead of start)]

afterwards /var/run/docker

Mirthless answered 22/1 at 18:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.