I am not entirely sure what mongodb does but I am pretty sure it does restart itself on update.
The problem with docker-engine is not that it doesn't restart itself, it actually does, which you can verify by running the following command after update:
sudo service docker status
It's just that it doesn't restart the running containers. I don't exactly know why it has to be like this because it could in theory be able to bring back the running containers if the service is restarted but for whatever reason, it doesn't do it.
There are two ways to workaround this issue.
The first and easy way it to exclude the update of docker-engine and do the update manually if you see it is available.
sudo apt-mark hold docker-engine
sudo apt-get upgrade
You should see a notice if there was an update and if the update was kept back
...
The following packages were kept back:
docker-engine
...
If you have containers that you cannot afford to restart at upgrade, you should go this route.
If however, you can afford to have them restarted, you can use the second approach. You can set restart policies when you start the containers, like so:
sudo docker run --restart=always -d image-name
This way, when docker-engine is restarted, the container is started with it. This means that on update, the container started this way gets started automatically.
sudo apt-mark docker-machine hold
which I want. Is it docker-machine or docker-engine? – Horatius