61

Have been using Docker successfully for a few weeks but today when I was following a set of instructions which suggested adding the following two lines to the docker configuration file at /etc/init/docker.conf:

limit memlock unlimited unlimited
limit nofile 262144

It then suggested restarting Docker with sudo /etc/init.d/docker restart. When I did this under Ubuntu 14.04 it reported back that:

  • Docker is managed via upstart, try using service docker restart

I tried sudo service docker restart to which it reported:

stop: Unknown job: docker

start: Unknown job: docker

Now I'm stuck with the docker daemon not running! I tried rebooting but it's still not running and when run something as simple as sudo docker version I get:

Client version: 1.2.0
Client API version: 1.14
Go version (client): go1.3.1
Git commit (client): fa7b24f
OS/Arch (client): linux/amd64
2014/10/01 09:57:45 Get http:///var/run/docker.sock/v1.14/version: dial unix /var/run/docker.sock: no such file or directory

To troubleshoot I tried starting the docker daemon on the commandline with:

sudo docker -d

And in another terminal window I am now able to run Docker normally. That's great but HOW do I get it to startup normally again? Also I notice that I have TWO docker config files:

/etc/init/docker.conf
/etc/init/docker.io.conf

They look like DUPs. Are they redundant? Which one should I be looking at? Do I need both?

I also noticed that this duplicity shows up when I run sudo service --status-all |grep docker I get both docker and docker.io as listed services. Grown.

1
  • Please note I really don't understand the mechanics of upstart and I suspect this is more of upstart problem then a docker issue.
    – ken
    Oct 1, 2014 at 9:20

6 Answers 6

63

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/.

5
  • 1
    now that you say this I remember that I too "fast-tracked" on Docker which is almost surely why I have two versions. Sadly I never wrote down what I did so I guess I'll reverse engineer it this morning.
    – ken
    Oct 2, 2014 at 7:37
  • 1
    I will also try sudo service docker restart again but i don't expect any change from before. When you say "clean up manually in /etc could you give an idea of what you mean? I suspect I'm going to need to go there but its an area I don't know enough about.
    – ken
    Oct 2, 2014 at 7:38
  • BTW, in /etc/apt/sources.list.d/ I have both a "docker.list" and a "docker.list.save" file which point to the http://get.docker.io/ubuntu. So that mystery is solved. I don't know the function of the "docker.list.save" file but other files in this directory also seem to have this sidecar file so I assume this is normal?
    – ken
    Oct 2, 2014 at 7:43
  • 2
    Well I'm going to mark this as the correct answer ... I simply removed the docker.io references from /etc/init and /etc/default (as well as getting a full night's sleep) and now sudo service docker start worked fine.
    – ken
    Oct 2, 2014 at 8:25
  • sudo service docker restart works for me and check status by sudo service docker status.
    – MechaCode
    May 7, 2018 at 10:45
22

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
1
  • 1
    That is the difference between su - root and su root. If logged in as su root, sudo service docker status is the only way to go. If logged in as su - root, service docker status should just work!
    – VanagaS
    Oct 16, 2016 at 7:01
9

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.

  1. I google "unknown job: docker.io", answers did not take effect.

  2. I looked for reasons of "unknown job" in /etc/init.d/, found no proper answer .

  3. I looked for way to debug script in /etc/init.d/, found no proper answer.

  4. Then, I did a clean:

    1. sudo apt-get remove docker.io
    2. rm every suspicious file by find / -name "*docker*", such as /etc/init/docker.io.conf, /etc/init.d/docker.io .
  5. 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/ .

8

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.

7

I had a same issue on ubuntu 14.04 Here is a solution

sudo service docker start

or you can list images

docker images
0

I had the same problem, and it was caused by line for insecured registry in: /etc/default/docker

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.