I generally let my server do its thing, but I run into an issue consistently when I install system updates and then reboot: Some docker containers come online, while others need to be started manually. All containers were running before the system shut down.
- My containers are managed with docker compose.
- Their compose files have
restart: always
- It's not always the same containers that fail to come online
- Some of them depend on an NFS mount point being ready on the host, but not all
Host is running Ubuntu Noble
Most of these containers were migrated from my previous server, and this issue never manifested.
I wonder if anyone has ideas for what to look for?
SOLVED
The issue was that docker was starting before my NFS mount point was ready, and the containers which depended on it were crashing.
Symptoms:
journalctl -b0 -u docker
showed the following log lines (-b0 means to limit logs to the most recent boot):
level=error msg="failed to start container" container=fe98f37d1bc3debb204a52eddd0c9448e8f0562aea533c5dc80d7abbbb969ea3 error="error while creating mount source path '/mnt/nas/REDACTED': mkdir /mnt/nas/REDACTED: operation not permitted"
...
level=warning msg="ShouldRestart failed, container will not be restarted" container=fe98f37d1bc3debb204a52eddd0c9448e8f0562aea533c5dc80d7abbbb969ea3 daemonShuttingDown=true error="restart canceled" execDuration=5m8.349967675s exitStatus="{0 2024-10-29 00:07:32.878574627 +0000 UTC}" hasBeenManuallyStopped=false restartCount=0
I had previously set my mount directory to be un-writable if the NFS were not ready, so this lined up with my expectations.
I couldn't remember how systemd names mount points, but the following command helped me find it:
systemctl list-units -t mount | grep /mnt/nas
It gave me mnt-nas.mount
as the name of the mount unit, so then I just added it to the After=
and Requires=
lines in my /etc/systemd/system/docker.service file:
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target docker.socket firewalld.service containerd.service time-set.target mnt-nas.mount
Wants=network-online.target containerd.service
Requires=docker.socket mnt-nas.mount
...
This movie is so hard to talk about, because the question is: "What is it even about?"
I like movies with abstract themes and strange storytelling, but this was just incomprehensible. Its plot revolves around the machinations of rich men to control the future of their city "New Rome", but the plot is kinda meaningless. There's never any real threat to Caesar's goal. Just plot events that could be obstacles but then are immediately resolved/neutered. Ok, fine! Surely then it's an art-house piece with a deep message? The plot points must be there for the sake of a larger theme. I was waiting for everything to add up in the finale, but it just ends up with Caesar delivering a speech filled with platitudes so bland that I thought it was a joke. Then the credits rolled and the 2 of the other 5 people in the theater with me started laughing.