Unable to start Docker Service in Ubuntu 16.04

杀马特。学长 韩版系。学妹 提交于 2019-11-28 17:29:11

Update

It seems that in newer versions of docker and Ubuntu the unit file for docker is simply masked (pointing to /dev/null).
You can verify it by running the following commands in the terminal:

sudo file /lib/systemd/system/docker.service
sudo file /lib/systemd/system/docker.socket

You should see that the unit file symlinks to /dev/null.
In this case, all you have to do is follow S34N's suggestion, and run:

sudo systemctl unmask docker.service
sudo systemctl unmask docker.socket
sudo systemctl start docker.service
sudo systemctl status docker

I'll also keep the original post, that answers the error log stating that the storage driver should be replaced:

Original Post

I had the same problem, and I tried fixing it with Salva Cort's suggestion, but printing /etc/default/docker says:

# THIS FILE DOES NOT APPLY TO SYSTEMD

So here's a permanent fix that works for systemd (Ubuntu 15.04 and higher):

  1. create a new file /etc/systemd/system/docker.service.d/overlay.conf with the following content:

    [Service]
    ExecStart=
    ExecStart=/usr/bin/docker daemon -H fd:// -s overlay
    
  2. flush changes by executing:

    sudo systemctl daemon-reload
    
  3. verify that the configuration has been loaded:

    systemctl show --property=ExecStart docker
    
  4. restart docker:

    sudo systemctl restart docker
    

The following unmasking commands worked for me (Ubuntu 18). Hope it helps someone out there... :-)

sudo systemctl unmask docker.service
sudo systemctl unmask docker.socket
sudo systemctl start docker.service
Roman Rhrn Nesterov

I had the same problem after upgrade docker from 17.05-ce to 17.06-ce via docker-machine

  1. Update /etc/systemd/system/docker.service.d/10-machine.conf

    replace

    `docker daemon` => `dockerd`
    

    example from

    [Service]
    ExecStart=
    ExecStart=/usr/bin/docker deamon -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --storage-driver aufs --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-key.pem --label provider=generic
    Environment=
    

    to

    [Service]
    ExecStart=
    ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --storage-driver aufs --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-key.pem --label provider=generic
    Environment=
    
  2. flush changes by executing:

    sudo systemctl daemon-reload
    
  3. restart docker:

    sudo systemctl restart docker
    

Well, finally I fixed it

Everything you have to do is to load a different storage-driver in my case I will use overlay:

  1. Disable Docker service: sudo systemctl stop docker.service
  2. Start Docker Daemon (overlay driver): sudo docker daemon -s overlay
  3. Run Demo container: sudo docker run hello-world

In order to make these changes permanent, you must edit /etc/default/docker file and add the option:

DOCKER_OPTS="-s overlay"

Next time Docker service get loaded, it will run docker daemon -s overlay

I've been able to get it working after a kernel upgrade by following the directions in this blog.

https://mymemorysucks.wordpress.com/2016/03/31/docker-graphdriver-and-aufs-failed-driver-not-supported-error-after-ubuntu-upgrade/

sudo apt-get update
sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual

sudo modprobe aufs

sudo service docker restart

After viewing some of the other answers it looks like the issue was that the service wasn't running with the -s overlay options.

I also happened to notice that docker tried to start up with ${DOCKER_OPTS} at the end of the call.

I was able to export DOCKER_OPTS="-s overlay" (bc by default DOCKER_OPTS was empty) and get docker running.

Jayhello

As to me, I have get this error.

Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

Finally I found, it the /etc/docker/daemon.json error, for I add registry-mirrors

{
    "runtimes": {

        "nvidia": {
            "path": "/usr/bin/nvidia-container-runtime",
            "runtimeArgs": []
        }
    }    

    # I forget to add a comma , here !!!!!!!
    "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]
}

After I add it , then systemctl restart docker, I solved it.

In my case I was getting the following error from journalctl -xe command

unable to configure the Docker daemon with file /etc/docker/daemon.json: invalid character 'â' looking for beginning of object key string

Just clean /etc/docker/daemon.json with

{
}

I had this issue today after an upgrade to the ubuntu kernel and tried numerous solutions above. However the only one that worked (Ubuntu 16.04.6 LTS) was to remove (or rename) the folder: /var/lib/docker

Please be aware, this will remove all your docker images, containers and volumes etc. So understand the implications before applying or take a backup!

There are more details here: https://github.com/docker/for-linux/issues/162

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!