Docker does not start

8,570

Solution 1

I had the similar error. The problem was in /etc/systemd/system/docker.service.d/godaddy.conf, there are located command to run a script to configure the network and iptables: ExecStartPost=/opt/godaddy/docker/configure-snat.

And in that script file, exactly this 2 lines was failing in my case:

...
iptables -t nat -D POSTROUTING -s ${DOCKER_NETWORK} ! -o docker0 -j SNAT --to ${PUBLIC_IP}
iptables -t nat -I POSTROUTING -s ${DOCKER_NETWORK} ! -o docker0 -j SNAT --to ${PUBLIC_IP}

The problem was with variable ${PUBLIC_IP} which by some reason was empty and generated script has ended at --too which is wrong, because --too requires an argument. So this created an error and failed my docker to start.

So the problem was not with the docker itself. After I commented this line: #ExecStartPost=/opt/godaddy/docker/configure-snat in /etc/systemd/system/docker.service.d/godaddy.conf. Problem solved. Docker started without any problems, in my case.

Solution 2

Remove files from /var/lib/docker. and then restart docker service .Backup the images as deleting the folder will delete your image data.

Share:
8,570

Related videos on Youtube

Gabriel Queiroz Schicora
Author by

Gabriel Queiroz Schicora

Updated on September 18, 2022

Comments

  • Gabriel Queiroz Schicora
    Gabriel Queiroz Schicora almost 2 years

    Good morning guys, I'm a beginner with the docker so I don't know much, but I need to install it. I have a VPS hosting at GoDaddy, I installed the docker following this guide and when I try to start the docker I get the error:

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

    Running systemctl status docker.service I get the following result:

    [root@ip-107-180-94-5 ~]# systemctl status docker.service -l
    ● docker.service - Docker Application Container Engine
       Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
      Drop-In: /etc/systemd/system/docker.service.d
               └─godaddy.conf
       Active: failed (Result: start-limit) since Wed 2020-01-29 06:49:01 MST; 4min 1s ago
         Docs: https://docs.docker.com
      Process: 3708 ExecStartPost=/opt/godaddy/docker/configure-snat (code=exited, status=2)
      Process: 3571 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=0/SUCCESS)
     Main PID: 3571 (code=exited, status=0/SUCCESS)
    
    Jan 29 06:48:59 ip-107-180-94-5.ip.secureserver.net systemd[1]: Failed to start Docker Application Container Engine.
    Jan 29 06:48:59 ip-107-180-94-5.ip.secureserver.net systemd[1]: Unit docker.service entered failed state.
    Jan 29 06:48:59 ip-107-180-94-5.ip.secureserver.net systemd[1]: docker.service failed.
    Jan 29 06:49:01 ip-107-180-94-5.ip.secureserver.net systemd[1]: docker.service holdoff time over, scheduling restart.
    Jan 29 06:49:01 ip-107-180-94-5.ip.secureserver.net systemd[1]: Stopped Docker Application Container Engine.
    Jan 29 06:49:01 ip-107-180-94-5.ip.secureserver.net systemd[1]: start request repeated too quickly for docker.service
    Jan 29 06:49:01 ip-107-180-94-5.ip.secureserver.net systemd[1]: Failed to start Docker Application Container Engine.
    Jan 29 06:49:01 ip-107-180-94-5.ip.secureserver.net systemd[1]: Unit docker.service entered failed state.
    Jan 29 06:49:01 ip-107-180-94-5.ip.secureserver.net systemd[1]: docker.service failed.
    

    Running journalctl -xe I get the following result:

    [root@ip-107-180-94-5 ~]# journalctl -xe-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit user-0.slice has finished starting up.--
    -- The start-up result is done.Jan 29 07:10:01 ip-107-180-94-5.ip.secureserver.net systemd[1]: Started Session 11104 of user root.-- Subject: Unit session-11104.scope has finished start-up
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel--
    -- Unit session-11104.scope has finished starting up.
    --
    -- The start-up result is done.Jan 29 07:10:01 ip-107-180-94-5.ip.secureserver.net systemd[1]: Started Session 11105 of user root.
    -- Subject: Unit session-11105.scope has finished start-up
    -- Defined-By: systemd-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel---- Unit session-11105.scope has finished starting up.
    --
    -- The start-up result is done.
    Jan 29 07:10:01 ip-107-180-94-5.ip.secureserver.net CROND[31560]: (root) CMD (/usr/local/cpanel/scripts/dcpumon-wr
    Jan 29 07:10:01 ip-107-180-94-5.ip.secureserver.net CROND[31561]: (root) CMD (/usr/lib64/sa/sa1 1 1)
    

    I followed some posts from people with the same error to anything I do works. I managed to get another result by running dockerd --debug, it stops on the following line and I need to abort the command:

    INFO[2020-01-29T07:14:39.129935890-07:00] API listen on /var/run/docker.sock
    

    After that if I run systemctl start docker it gets stuck without giving back and I need to abort the command again, then after that I check the status withsystemctl status docker.service -l generates the following result:

    ● docker.service - Docker Application Container Engine
       Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
      Drop-In: /etc/systemd/system/docker.service.d
               └─godaddy.conf
       Active: activating (start-post) since Wed 2020-01-29 07:17:17 MST; 1min 39s ago
         Docs: https://docs.docker.com
     Main PID: 32176 (dockerd);         : 32313 (configure-snat)
        Tasks: 15
       Memory: 39.6M
       CGroup: /system.slice/docker.service
               ├─32176 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
               └─control
                 ├─ 5261 sleep 0.1
                 └─32313 /bin/bash /opt/godaddy/docker/configure-snat
    
    Jan 29 07:18:56 ip-107-180-94-5.ip.secureserver.net configure-snat[32313]: Cannot connect to the Docker daemon atunix:///var/run/docker.sock. Is the docker daemon running?
    Jan 29 07:18:56 ip-107-180-94-5.ip.secureserver.net configure-snat[32313]: waiting for docker bridge...
    Jan 29 07:18:56 ip-107-180-94-5.ip.secureserver.net configure-snat[32313]: Cannot connect to the Docker daemon atunix:///var/run/docker.sock. Is the docker daemon running?
    Jan 29 07:18:56 ip-107-180-94-5.ip.secureserver.net configure-snat[32313]: waiting for docker bridge...
    Jan 29 07:18:56 ip-107-180-94-5.ip.secureserver.net configure-snat[32313]: Cannot connect to the Docker daemon atunix:///var/run/docker.sock. Is the docker daemon running?
    Jan 29 07:18:56 ip-107-180-94-5.ip.secureserver.net configure-snat[32313]: waiting for docker bridge...
    Jan 29 07:18:56 ip-107-180-94-5.ip.secureserver.net configure-snat[32313]: Cannot connect to the Docker daemon atunix:///var/run/docker.sock. Is the docker daemon running?
    Jan 29 07:18:56 ip-107-180-94-5.ip.secureserver.net configure-snat[32313]: waiting for docker bridge...
    Jan 29 07:18:56 ip-107-180-94-5.ip.secureserver.net configure-snat[32313]: Cannot connect to the Docker daemon atunix:///var/run/docker.sock. Is the docker daemon running?
    Jan 29 07:18:57 ip-107-180-94-5.ip.secureserver.net configure-snat[32313]: waiting for docker bridge...
    

    Following other tips I ran the dockerd command and generated the result:

    WARN[2020-01-29T07:20:27.025438855-07:00] The "graph" config file option is deprecated. Please use "data-root" instead.
    INFO[2020-01-29T07:20:27.025693705-07:00] Starting up
    failed to start daemon: pid file found, ensure docker is not running or delete /var/run/docker.pid
    

    So I delete the .pid file and the result changes to:

    WARN[2020-01-29T07:22:44.060324431-07:00] The "graph" config file option is deprecated. Please use "data-root" instead.
    INFO[2020-01-29T07:22:44.061145504-07:00] Starting up
    INFO[2020-01-29T07:22:44.064401028-07:00] parsed scheme: "unix"                         module=grpc
    INFO[2020-01-29T07:22:44.064684277-07:00] scheme "unix" not registered, fallback to default scheme  module=grpc
    INFO[2020-01-29T07:22:44.064771804-07:00] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0  <nil>}] <nil>}  module=grpc
    INFO[2020-01-29T07:22:44.064814177-07:00] ClientConn switching balancer to "pick_first"  module=grpc
    INFO[2020-01-29T07:22:44.070245283-07:00] parsed scheme: "unix"                         module=grpc
    INFO[2020-01-29T07:22:44.070333997-07:00] scheme "unix" not registered, fallback to default scheme  module=grpc
    INFO[2020-01-29T07:22:44.070364847-07:00] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0  <nil>}] <nil>}  module=grpc
    INFO[2020-01-29T07:22:44.070390331-07:00] ClientConn switching balancer to "pick_first"  module=grpc
    WARN[2020-01-29T07:22:44.071893568-07:00] [graphdriver] WARNING: the overlay storage-driver is deprecated, and will be removed in a future release
    failed to start daemon: error while opening volume store metadata database: timeout
    

    And after that I couldn't go on to anything else, I already reinstalled the docker about 2 times and still nothing. Can anyone help me? I'm using the CentOS 7 distribution.

  • nulltron
    nulltron over 3 years
    This right here just saved me.