Docker service failed to start

Viewed 3185

After reboot virtual machinem the command docker images command shows error:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

It seems the docker service is not working normally. I tried to start docker service on Ubuntu VM (v 20.10), the docker engine is at version 20.10.5. My troubleshooting with systemctl status docker show:

docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sun 2021-06-06 03:32:23 UTC; 13min ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
    Process: 7228 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=2)
   Main PID: 7228 (code=exited, status=2)

Jun 06 03:32:20 cdipp-srv systemd[1]: Failed to start Docker Application Container Engine.
Jun 06 03:32:23 cdipp-srv systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Jun 06 03:32:23 cdipp-srv systemd[1]: Stopped Docker Application Container Engine.
Jun 06 03:32:23 cdipp-srv systemd[1]: docker.service: Start request repeated too quickly.
Jun 06 03:32:23 cdipp-srv systemd[1]: docker.service: Failed with result 'exit-code'.
Jun 06 03:32:23 cdipp-srv systemd[1]: Failed to start Docker Application Container Engine.

journalctl -ex shows:

Jun 06 03:32:20 cdipp-srv dockerd[7228]: github.com/docker/docker/vendor/golang.org/x/net/http2.readFrameHeader(0xc00051d298, 0x9, 0x9, 0x5615697ad340, 0xc000bb3560, 0x0, 0xc0272e510000000>
Jun 06 03:32:20 cdipp-srv dockerd[7228]:         /go/src/github.com/docker/docker/vendor/golang.org/x/net/http2/frame.go:237 +0x89
Jun 06 03:32:20 cdipp-srv dockerd[7228]: github.com/docker/docker/vendor/golang.org/x/net/http2.(*Framer).ReadFrame(0xc00051d260, 0xc000fcbb40, 0xc000fcbb40, 0x0, 0x0)
Jun 06 03:32:20 cdipp-srv dockerd[7228]:         /go/src/github.com/docker/docker/vendor/golang.org/x/net/http2/frame.go:492 +0xa3
Jun 06 03:32:20 cdipp-srv dockerd[7228]: github.com/docker/docker/vendor/google.golang.org/grpc/internal/transport.(*http2Client).reader(0xc000167880)
Jun 06 03:32:20 cdipp-srv dockerd[7228]:         /go/src/github.com/docker/docker/vendor/google.golang.org/grpc/internal/transport/http2_client.go:1265 +0x185
Jun 06 03:32:20 cdipp-srv dockerd[7228]: created by github.com/docker/docker/vendor/google.golang.org/grpc/internal/transport.newHTTP2Client
Jun 06 03:32:20 cdipp-srv dockerd[7228]:         /go/src/github.com/docker/docker/vendor/google.golang.org/grpc/internal/transport/http2_client.go:300 +0xd25
Jun 06 03:32:20 cdipp-srv dockerd[7228]: goroutine 642 [select]:
Jun 06 03:32:20 cdipp-srv dockerd[7228]: github.com/docker/docker/libcontainerd/remote.(*client).processEventStream(0xc0001503f0, 0x561569815820, 0xc00004fe40, 0x5615685fc82d, 0x4)
Jun 06 03:32:20 cdipp-srv dockerd[7228]:         /go/src/github.com/docker/docker/libcontainerd/remote/client.go:782 +0x314
Jun 06 03:32:20 cdipp-srv dockerd[7228]: created by github.com/docker/docker/libcontainerd/remote.NewClient
Jun 06 03:32:20 cdipp-srv dockerd[7228]:         /go/src/github.com/docker/docker/libcontainerd/remote/client.go:70 +0x27f
Jun 06 03:32:20 cdipp-srv dockerd[7228]: goroutine 641 [chan receive]:
Jun 06 03:32:20 cdipp-srv dockerd[7228]: github.com/docker/docker/daemon.(*Daemon).execCommandGC(0xc00000c3c0)
Jun 06 03:32:20 cdipp-srv dockerd[7228]:         /go/src/github.com/docker/docker/daemon/exec.go:309 +0x14b
Jun 06 03:32:20 cdipp-srv dockerd[7228]: created by github.com/docker/docker/daemon.NewDaemon
Jun 06 03:32:20 cdipp-srv dockerd[7228]:         /go/src/github.com/docker/docker/daemon/daemon.go:1140 +0x2aa9
Jun 06 03:32:20 cdipp-srv dockerd[7228]: goroutine 897 [sleep]:
Jun 06 03:32:20 cdipp-srv dockerd[7228]: runtime.goparkunlock(...)
Jun 06 03:32:20 cdipp-srv dockerd[7228]:         /usr/local/go/src/runtime/proc.go:310
Jun 06 03:32:20 cdipp-srv dockerd[7228]: time.Sleep(0x1dcd6500)
Jun 06 03:32:20 cdipp-srv dockerd[7228]:         /usr/local/go/src/runtime/time.go:105 +0x15d
Jun 06 03:32:20 cdipp-srv dockerd[7228]: github.com/docker/docker/vendor/github.com/docker/swarmkit/node.(*Node).initManagerConnection(0xc0003c85a0, 0x561569815820, 0xc000930500, 0xc0008b6>
Jun 06 03:32:20 cdipp-srv dockerd[7228]:         /go/src/github.com/docker/docker/vendor/github.com/docker/swarmkit/node/node.go:937 +0x352
Jun 06 03:32:20 cdipp-srv dockerd[7228]: created by github.com/docker/docker/vendor/github.com/docker/swarmkit/node.(*Node).runManager
Jun 06 03:32:20 cdipp-srv dockerd[7228]:         /go/src/github.com/docker/docker/vendor/github.com/docker/swarmkit/node/node.go:1064 +0x49a
Jun 06 03:32:20 cdipp-srv systemd[1]: docker.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- An ExecStart= process belonging to unit docker.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 2.
Jun 06 03:32:20 cdipp-srv systemd[1]: docker.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit docker.service has entered the 'failed' state with result 'exit-code'.
Jun 06 03:32:20 cdipp-srv systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: A start job for unit docker.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support

Please help with any idea to resolve the problem. Any additional diagnose needed?

2 Answers

Try to update your system, especially the packages related to Docker. Then start Docker.service to see if it runs successfully.

For me the problem was solved by installing another version of Docker; had 20.10.17 and switched back to 20.10.12. Another issue for me was that I had directory /var/lib/docker relocated due to storage issues and after the fresh reinstall, I modified /lib/systemd/system/docker.service to point to my custom docker directory.

Related