docker / for-linux

Docker Engine for Linux
https://docs.docker.com/engine/installation/
751 stars 84 forks source link

Do not "Bind" docker "To" containerd. #678

Open Random-Liu opened 5 years ago

Random-Liu commented 5 years ago

Expected behavior

After containerd is temporarily killed and restarted, docker should continue working.

Actual behavior

Once containerd is killed, docker will be stopped by systemd. And systemd won't restart docker anymore, "when the death of the process is a result of systemd operation (e.g. service stop or restart)" (See https://github.com/systemd/systemd/issues/2824)

Steps to reproduce the behavior

sudo pkill -x containerd
sudo systemctl status docker # docker won't be running any more.

Output of docker version:

Client:
 Version:           18.09.3
 API version:       1.39
 Go version:        go1.10.4
 Git commit:        774a1f4
 Built:             Mon Mar 25 20:45:29 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.09.3
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.4
  Git commit:       774a1f4
  Built:            Mon Mar 25 20:21:49 2019
  OS/Arch:          linux/amd64
  Experimental:     false

Output of docker info:

C Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 
runc version: N/A
init version: v0.18.0 (expected: fec3683b971d9c3ef73f284f176672c44b448662)
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.15.0-1028-gcp
Operating System: Ubuntu 18.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 3.606GiB
Name: ubuntu-gke-1804-d1809-0-v20190326
ID: JLVJ:TCIH:WF2Z:PJ5O:UMXX:HVNI:R4EW:N4X2:LCOP:72MR:HABB:XTKY
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: true

WARNING: No swap limit support

Additional environment details (AWS, VirtualBox, physical, etc.) GCE

andrewhsu commented 5 years ago

I reproduced this behaviour with 19.03 as well...

When the containerd executable is killed, the containerd service goes into the inactive (dead) state and so does the docker service.

Just starting the containerd service with systemctl start containerd is not enough to get docker going again. Need to also do a systemctl start docker to get the service back up.

@seemethere @kolyshkin is there a systemd.unit directive that can gracefully have the docker service start up again if the only reason why it was down was because the containerd service went down? we may need a healthcheck to accomplish this. dunno, thinking out loud here.

mihao commented 5 years ago

Now that containerd has Restart=always in the unit file, we just need to change BindTo=containerd.service to Requires=containerd.service in the Docker unit file, as in my pull request.