Tips on getting docker to work without having to run `sudo docker -d` on Ubuntu 15.04
Asked Answered
A

3

8

After upgrading my system from 14.10 to 15.04 I can't seem to use docker like I used to. I already have a docker group that my user is part of and I used to be able to use docker without sudo just fine. Now I can't use it unless I have sudo docker -d running in another terminal. Simply running docker ps gives me this error:

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

I've tried reinstalling, rebooting, restarting services, and blowing out configurations to no avail. Any tips would be appreciated. As a side note, I installing 15.04 in a vm to see if I could get docker working there and I was able to set it up no problem. seems like an issue specific to those who have upgraded from 14.10.

Augustaugusta answered 23/4, 2015 at 22:31 Comment(7)
Since it is related to a new Ubuntu release, this should have been asked on askubuntu.com or on any docker forum, maybe on serverfault.com.Annular
ubuntu 15.04 switched from upstart to systemd - wiki.ubuntu.com/SystemdForUpstartUsers - that is why docker service is not started automatically.Lockman
@Alexander, good point, I'll go ahead and look into those forumns.Augustaugusta
@ISanych, that's what I thought too, however even when I set up the service through systemctl it doesn't work.Augustaugusta
@Augustaugusta Is there anything in the journalctl logs regarding the service?Haustorium
A relevant (I think) bug report github.com/docker/docker/issues/12002Tinworks
@Haustorium not sure, I ended up doing a clean install of ubuntu and that seemed to fix it. It was a very odd issue and it seemed like it may have been an issue more specific with my upgrade.. Regardless, this answer will probly help most coming to this question.Augustaugusta
B
5

Did u checked this http://docs.docker.com/articles/systemd/? This helped me to start docker under Ubunu 15.04.

Buzz answered 29/4, 2015 at 7:22 Comment(3)
Links tend to change or go missing, could you explain some of the contents or quote it here?Unaneled
the link works for me, by this command "sudo systemctl enable docker" make docker service start at boot.Epigraphic
After I did a clean install of Ubuntu this worked for me. However what's odd is that these steps didn't work for me after my initial upgrade to 15.04. Even when I wiped out my docker install and started over.. Very odd.Augustaugusta
G
1

What to do if this fails...

$ sudo usermod -aG docker $USER

..and you have added user to docker group and Ubuntu still requires sudo:

If you initially ran Docker CLI commands using sudo before adding your user to the docker group, you may see the following error, which indicates that your ~/.docker/ directory was created with incorrect permissions due to the sudo commands.

To fix this problem, either remove the ~/.docker/ directory (it is recreated automatically, but any custom settings are lost), or change its ownership and permissions using the following commands:

$ sudo chown "$USER":"$USER" /home/"$USER"/.docker -R

$ sudo chmod g+rwx "$HOME/.docker" -R
Gasperoni answered 2/4, 2019 at 5:6 Comment(0)
G
0

What the link mafahand provided tells is how to use docker on a systemd based host. Ubuntu 15.04 uses systemd now while older version used upstart. That might explain why upgraded systems show erratic behavior. Check out the Ubuntu wiki for some help on that regard.

After installing docker via

sudo apt install docker.io

you might have to reboot your system or start the docker.socket unit manually. For some reason that did not happen on my machine after installing it.

Type

systemctl status docker

to check whether docker is up and running. If it is not enabled use

sudo systemctl enable docker

to enable it permanently and/or

sudo systemctl start docker

to run the service.

Grimes answered 27/5, 2015 at 9:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.