The Synology Docker package will generate the notification Docker container xxxx stopped unexpectedly when the following two conditions are met:
- The container exits with a
die
docker event (you can see this happen by monitoring docker events
when the container exits). This is any case where the main process in the container exits on its own. The exitCode
does not matter.
- The container is considered "enabled" by the Synology Docker GUI. This information is stored in
/var/packages/Docker/etc/container_name.config
:
{
"enabled" : true,
"exporting" : false,
"id" : "dbee87466fb70ea26cd9845fd79af16d793dc64d9453e4eba43430594ab4fa9b",
"image" : "busybox",
"is_ddsm" : false,
"is_package" : false,
"name" : "musing_cori",
"shortcut" : {
"enable_shortcut" : false,
"enable_status_page" : false,
"enable_web_page" : false,
"web_page_url" : ""
}
}
How to enable/disable containers with Synology's Docker GUI
Containers are automatically enabled if you start them from the GUI. All of these things will cause the container to become "enabled" and start notifying on exit:
- Sliding the "toggle switch" in the container view to "on"
- Using Action start on the container.
- Opening the container detail panel and clicking "start"
This is probably how your container ended up "enabled" and why it is now notifying whenever it exits. Containers created with docker run -d ...
do not start out enabled, and will not initially warn on exit. This is probably why things like docker run -it --rm busybox
and other ephemeral containers do not cause notifications.
Containers can be disabled if you stop them while they are running. There appears to be no way to disable a container which is currently stopped. So to disable a container you must start it and then stop it before it exits on its own:
- Slide the toggle switch on then off as soon as it will let you.
- Use Action start and then stop as soon as it will let you (this is hard because of the extra click if your container is very shortlived).
- Open the controller detail panel, click start, and then as soon as "stop" is not grayed out, click "stop".
Check your work by looking at /var/packages/Docker/etc/container_name.config
.