Don't restart certain docker containers after a host restart
What does this MR do?
Currently, every time I reboot my (Linux) computer, the two containers mailqueuerunner
and phpmyadmin
will restart automatically. phpmyadmin
does so successfully, but mailqueuerunner
keeps failing and endlessly restarting (because the database does not also start automatically).
This is annoying because:
- Of course, it's a waste of system resources
- It keeps spamming the kernel log like this (due to container network adapters being created/removed over and over):
[ 4239.839888] veth513ba89: renamed from eth0
[ 4239.896333] br-54b2714e0c02: port 1(veth47a223b) entered disabled state
[ 4239.899789] device veth47a223b left promiscuous mode
[ 4239.899801] br-54b2714e0c02: port 1(veth47a223b) entered disabled state
[ 4299.839589] br-54b2714e0c02: port 1(veth1c237fa) entered blocking state
[ 4299.839605] br-54b2714e0c02: port 1(veth1c237fa) entered disabled state
[ 4299.839978] device veth1c237fa entered promiscuous mode
[ 4300.065007] eth0: renamed from veth9dddaa5
[ 4300.081448] IPv6: ADDRCONF(NETDEV_CHANGE): veth1c237fa: link becomes ready
[ 4300.081485] br-54b2714e0c02: port 1(veth1c237fa) entered blocking state
[ 4300.081488] br-54b2714e0c02: port 1(veth1c237fa) entered forwarding state
[ 4300.318537] br-54b2714e0c02: port 1(veth1c237fa) entered disabled state
[ 4300.319185] veth9dddaa5: renamed from eth0
[ 4300.366614] br-54b2714e0c02: port 1(veth1c237fa) entered disabled state
[ 4300.368684] device veth1c237fa left promiscuous mode
[ 4300.368690] br-54b2714e0c02: port 1(veth1c237fa) entered disabled state
- Output of tools like
ip
keeps changing - same for NetworkManager GUI
Running scripts/docker-compose stop
will shut this up, but they'll come back with the next host reboot due to their restart policy being always
(docs: https://docs.docker.com/config/containers/start-containers-automatically/#use-a-restart-policy).
This MR changes the restart policy for those two containers to unless-stopped
, which will respect manual stopping and (from my understanding) also not restart on host reboot.
How confident are you it won't break things if deployed?
dev only change
How to test
Steps a reviewer can take to verify that this MR does what it says it does e.g.
- Checkout branch locally
- run start script
- restart the
docker
service (from docker's perspective, restarting the host is just a docker service restart) - ensure no containers start by themselves
Checklist
-
added a test, or explain why one is not needed/possible... -
no unrelated changes -
asked someone for a code review -
set a "for:" label to indicate who will be affected by this change -
use "state:" labels to track this MR's state until it was beta tested -
added an entry to CHANGELOG.md