Today we are going to look at two different ways on how to update Docker containers on a Synology NAS.
Last week, we looked at how to install Docker containers on a Synology NAS. I excluded this portion as I felt it deserved its own tutorial. I will preface this by saying there are various methods online on how you can update containers on a Synology NAS and that this is my preferred approach.
This approach gives me a full rollback plan if I experience any issues with the new version, which a lot of other “update” solutions do not provide.
I normally install the new container, let it run for a few days to ensure that everything works as expected, and then delete the old container.
If I run into any issues (I have run into issues with new versions of containers before), I delete the new container, rename my old container, and then I’m back to using the old container without any issues.
Before you get started with an update, always back up the docker folder on your Synology NAS.
How to Update Docker Containers on a Synology NAS
We will look at two different ways to update docker containers on a Synology NAS below.
Updating Docker Containers on a Synology NAS Using the Docker Application
1. I will be displaying how to do this using Nginx Proxy Manager since the version number is directly on the login page. My container is currently using v2.5.0.
2. Open the registry, search for the container that you’d like to update, and double-click it to download the latest version. The latest version will overwrite your existing version. Make sure you give it a little while to finish the download.
3. Stop the old container, Edit it, and rename the container. I normally leave it as-is and add -Backup to the name.
4. When the container is renamed, select the container, then select Settings, and then Duplicate Settings. Give the new container a name (I normally use the old name), select Apply and then the container will install! When you run the new container, you will be using the latest version!
5. The container is now setup! If you run into any issues, delete the new container, rename the old one back (by removing -Backup) and you will be fully rolled back to the old version of the Docker container.
Updating Docker Containers on a Synology NAS Using Docker Compose
Updating a container using Docker Compose is slightly different than running Synology’s GUI. When we use Synology’s GUI and duplicate the settings, we are technically creating an entirely new container and keeping our old one as well.
Since Docker Compose uses our configuration file to create the container, it’s not easy to do that.
For that reason, it’s almost easier to update the container and fix it (update the Docker Compose file to use an old version) if there’s a problem, rather than preemptively plan for it.
This is only my personal opinion of course! If you’d prefer to take a backup of the container, rename the container’s folder on your Synology NAS, copy it to a new location, and then create the new container as shown in our last tutorial.
1. Get a list of running containers.
sudo docker container ls
2. Stop the container that you’d like to update by running the command below and substituting the correct container ID.
sudo docker stop [CONTAINER_ID]
3. Navigate to the folder where the Docker Compose file exists.
cd /volume[#]/docker/[CONTAINER_FOLDER]
4. Run the commands below. The first command will pull the latest image and the second will install the package.
sudo docker-compose pull sudo docker-compose up --force-recreate --build --detach
5. The container will now be updated and running!
Conclusion – How to Update Docker Containers on a Synology NAS
This tutorial showed how to update Docker containers on a Synology NAS. Like I said initially, this is only my preferred approach and doesn’t mean it’s the only way of doing it.
Thank you for checking out the tutorial on how to update Docker Containers on a Synology NAS. As always, if you have any questions on how to update Docker Containers on a Synology NAS, please leave them in the comments!
I had the same issue as btwdnewbie. Container was stopped and still my ports had to be edited on the old container to allow my custom ports to be configured on the new one. Probably would have worked if I had them set to Auto.
Thanks for the tutorial.
Glad you got it working. Thanks for the feedback! Hopefully it can help someone else.
Hi guys,
On my side, to update a container using Synology docker GUI, I just first download the new container image as you did (Through the registry), then stop my container to update, then Actions > Clear. And finally just start the container / done ! this trick do not delete my config and data and upgrade “in place” my container
Hope this helps
Thank you for sharing! This method unfortunately doesn’t work for me (it says the container won’t start), but I know that this works for other people. Either way, thanks for sharing!
Thank you for your tutorial! Following the given steps I ran into problems updating the bitwarden-docker container. Because the respective port was assigned to the old (backed-up) container I need to “free” the port to assign it to the new one.
Did you stop the container before creating the new one? If you didn’t, that should solve the problem!