Reputation: 107
I recently started using docker on raspberry pi. I am using a set of docker containers that are run constantly e.g. pihole, node red, mosquitto etc. I know that if you have to restart raspberry pi then you should stop the containers first and then restart them once the pi has rebooted. But in some other tutorials I see they check for update by using the command sudo apt updates for the raspberry pi OS and install the updates if they are available. I want to know the following:
Should I stop the containers before checking and installing updates for the raspberry pi OS?
do you need to stop all the containers that depend on each other before updating any one of the container or just stop the container that needs to be updated?
Upvotes: 1
Views: 1733
Reputation: 311606
Should I stop the containers before checking and installing updates for the raspberry pi OS?
Generally, no, updates on the host won't have any impact on your containers. The exception is if you install an update to Docker, which may restart the Docker daemon. This can cause all your containers to exit, although they will come back up automatically if you have configured them with a restart policy. And of course a kernel update will require a host reboot before it becomes active.
do you need to stop all the containers that depend on each other before updating any one of the container or just stop the container that needs to be updated?
This really depends on how you have designed your applications.
Consider a web application that talks to a database. If you were to remove the database container and create a new one with updated software or configuration, depending on how the web application is written:
It might crash, requiring you to restart it manually.
If you have configured it with a restart policy, Docker might take care of restarting it for you.
If the application has reconnect/retry logic, it might simply wait until the database is back up and available.
The application itself might require an update before it is able to run correctly.
It's up to you to understand that dependencies in your software stack and determine how best to handle component upgrades.
Upvotes: 2