Starting Docker as Daemon on Ubuntu
There are multiple popular repositories offering docker packages for Ubuntu. The package docker.io
is (most likely) from the Ubuntu repository. Another popular one is http://get.docker.io/ubuntu
which offers a package lxc-docker
(I am running the latter because it ships updates faster). Make sure only one package is installed. Not quite sure if removal of the packages cleans up properly. If sudo service docker restart
still does not work, you may have to clean up manually in /etc/.
I had the same issue on 14.04 with docker 1.9.1.
The upstart service command did work when I used sudo, even though I was root:
$ whoami
root
$ service docker status
status: Unbekannter Auftrag: docker
$ sudo service docker status
docker start/running, process 7394
It seems to depend on the environment variables.
service docker status
works when becoming root with su -
, but not when only using su
:
$ su
Password:
$ service docker status
status: unknown job: docker
$ exit
$ su -
Password:
$ service docker status
docker start/running, process 2342
This problem really cost me some hours.
My system is Ubuntu 14.04, I installed docker by sudo apt-get install docker
, and typed some other commands that caused the problem.
I google "unknown job: docker.io", answers did not take effect.
I looked for reasons of "unknown job" in
/etc/init.d/
, found no proper answer .I looked for way to debug script in
/etc/init.d/
, found no proper answer.-
Then, I did a clean:
sudo apt-get remove docker.io
- rm every suspicious file by
find / -name "*docker*"
, such as/etc/init/docker.io.conf
,/etc/init.d/docker.io
.
Follow the latest official document: https://docs.docker.com/installation/, there is a lot of outdated documentation which can be misleading.
Finally, it fixed the problem.
Note: If you are in China, because of the GFW, you may need to set the https_proxy to install docker from https://get.docker.com/ .
I know this questions has been answered, however the reason this is happening to you, was probably because you did not add your username to the docker group.
Here are the steps to do it:
Add the docker group if it doesn't already exist:
sudo groupadd docker
Add the connected user ${USER}
to the docker group. Change the user name to match your preferred user:
sudo gpasswd -a ${USER} docker
Restart the Docker daemon:
sudo service docker restart
If you are on Ubuntu 14.04-15.10* use docker.io instead:
sudo service docker.io restart
(If you are on Ubuntu 16.04 the service is named "docker" simply)
Either do a newgrp
docker or log out/in to activate the changes to groups.