Docker exited for no apparent reason and I'm trying to understand what happened.
Right now the docker daemon is a loaded service, inactive with an exit status 0 SUCCESS.
$ systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Tue 2020-12-01 06:25:16 UTC;
Docs: https://docs.docker.com
Main PID: 2218 (code=exited, status=0/SUCCESS)
Looking at the docker logs, this happened because it processed signal 'terminated':
$ journalctl -u docker.service | tail -25
Nov 30 18:30:21 ip-10-38-4-210 dockerd[2218]: time="2020-11-30T18:30:21.728694550Z" <redacted irrelevant>
Dec 01 06:25:05 ip-10-38-4-210 systemd[1]: Stopping Docker Application Container Engine...
Dec 01 06:25:05 ip-10-38-4-210 dockerd[2218]: time="2020-12-01T06:25:05.867748396Z" level=info msg="Processing signal 'terminated'"
Dec 01 06:25:16 ip-10-38-4-210 systemd[1]: Stopped Docker Application Container Engine.
No user was logged in on that host at that time, no user explicitly terminated the docker daemon.
This is Docker version 18.09.7 (build 2d0083d) on Ubuntu 16.04.6 LTS on x86-64.
The relationship with systemd is being asked on Unix.stackexchange here
You're running a shell in a container, but you haven't assigned a terminal: If you're running a container with a shell (like bash ) as the default command, then the container will exit immediately if you haven't attached an interactive terminal.
The easiest way to keep the container running is to change its entry point to a command that will continue running forever. Let's use tail -f /dev/null . Rechecking the running container via docker ps -a we can see that our container has been up and running for several seconds and hasn't stopped yet.
Dockerfile Command to Keep the Container Running Method 1: You can use the -t (pseudo-tty) docker parameter to keep the container running. Method 2: You can run the container directly passing the tail command via arguments as shown below. Method 3: Another method is to execute a sleep command to infinity.
If you run a container using docker run and it immediately exits and every time you press the Start button in Docker Desktop it exits again, there is a problem. The way to figure out what is wrong is to run docker logs, adding the name of the container at the end:
To stop Docker when you have started it manually, issue a Ctrl+C in your terminal. There are two ways to configure the Docker daemon: Use a JSON configuration file.
In short, this Docker Error response from daemon I/O timeout mainly occurs due to either DNS error or network infrastructure issue. Today, we saw the solution to this error.
The Docker daemon persists all data in a single directory. This tracks everything related to Docker, including containers, images, volumes, service definition, and secrets. By default this directory is:
Dec 01 06:25:05 ip-10-38-4-210 systemd[1]: Stopping Docker Application Container Engine...
At this point, systemd sent docker a stop request.
Dec 01 06:25:05 ip-10-38-4-210 dockerd[2218]: time="2020-12-01T06:25:05.867748396Z" level=info msg="Processing signal 'terminated'"
Docker received that stop request and exits gracefully.
Dec 01 06:25:16 ip-10-38-4-210 systemd[1]: Stopped Docker Application Container Engine.
Systemd now reports the stop has finished. The 10 seconds is likely from containers that did not gracefully handle the docker container stop
command and were killed after 10 seconds, then another second to finish processing the request.
So from the logs provided, the dockerd daemon is functioning as requested and you should check what would have sent a systemctl stop docker
command.
Can I configure dockerd to restart automatically upon exits?
dockerd doesn't control systemd, systemd controls dockerd, so you'd need to solve the issue from the systemd side.
In this specific case, the thing telling systemd to stop the docker service appears to be the Ubuntu unattended-update service applying updates the the Ubuntu version of the containerd package.
https://bugs.launchpad.net/ubuntu/+source/containerd/+bug/1870514
My recommended fix would be to install docker from the upstream Docker repositories which does not appear to have this issue:
https://docs.docker.com/engine/install/ubuntu/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With