How to Update a Docker Container using Portainer

Today we are going to look at how to update a Docker container using Portainer.

There are many different ways to update Docker containers, but Portainer makes the process somewhat straightforward. To demo how to update a Docker container using Portainer, I will be updating an Nginx Proxy Manager container. Currently, I’m running an old version (2.3.1) and we will be updating that to the latest version.

Before starting this process, ensure that your container is created properly and volumes exist with your important data. If the data is not mapped to a local folder, it will be overwritten with the latest image data.

1. Instructions

1. Select Containers, then stop the container that you’d like to update.

portainer update docker container

2. Select the container, and you’ll see a button named Recreate. By selecting this button, the container will take the persistent data and recreate the container. Keep in mind that the only data that will stay on the container is data that was mapped to a volume. This is explained in greater detail in the video above.

portainer update docker container

3. Select Pull latest image, then Recreate.

portainer update docker container

4. When this process is finished, the container will be recreated with the latest image. Select the container and Start it. The status will change to running.

portainer update docker container

5. The container will now exist with the newest released version!

update portainer8

2. Conclusion - Portainer Update Docker Container

As I stated above, this is not the only way of doing this. There are various ways, but this is what I consider to be the easiest. It’s good to periodically check and ensure that your containers are running the latest version. Keep in mind that you can always recreate an existing container using an older version if you run into any unexpected problems. This is what makes Docker containers so easy to work with!

Thanks for reading the tutorial. If you have any questions, feel free to leave them in the comments!

This Post Has 15 Comments

  1. Hello,
    I am just recently getting started with Docker and Portainer on my synology NAS and I find all your tutorials incredibly helpful and very well documented.
    One crucial part that I am sadly lacking is, how do I (correctly) install an image via portainer in the first place, especially where do I do the mapping between the synology folders and the mounted ones in the container?
    It is probably a total beginner question for you, but maybe it is worth it to do a tutorial on it. Maybe I am not the only one with this problem

    1. That’s one of the main reasons I haven’t created a tutorial on Portainer. I love Portainer (use it for all other Docker instances on other OS’s), but I find it a little confusing on Synology’s. In summary, I believe that you have to set the exact volume path of the Docker folder. I am not positive of this (I will try and do some testing at some point), but that’s how I remember it working. I apologize as I know this isn’t the best help! Please let me know if I can answer anything else!

  2. I’m following your youtube channel. Thank you for the great work. I wonder if you can provide us with an app template that works with Portainer on a Raspberry pi (arm based). Also, I wonder if you could show us how we can pull a Docker image from Docker Hub using Portainer, and create a stack on portainer. WordPress and SQL would be great. Kudus!!

    1. Thanks so much! I will add these to my list of tutorials. I will also look into developing an app template one day!

  3. Since portainer is an a container as well, can you describe how to update the portainer container itself?

    1. The best way to update it is to delete the container (while keeping all of the volume information), and then recreating it with the same volumes. This will ensure that everything is updated and your data stays the same.

    2. the best way to update the portainer container is to use the following from the command line (assuming you’ve installed it at default paths) :

      docker stop portainer
      docker rm portainer
      docker pull portainer/portainer-ce
      docker run -d -p 8000:8000 -p 9000:9000 –name=portainer –restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce

  4. Hey Frank, thank you very much for your valuable tutorials.

    What happens if an image has been renamed (like bitwarden-rs –> vaultwarden)? Will portainer be able to pull the latest image on its own, or do we need to somehow specify the new name of the image?

    1. Thank you! Unfortunately, you will have to recreate the container. I feel like it’s fairly infrequent, but I suspect that there was a request from Bitwarden to rename the container for clarity purposes (since it’s not created by the bitwarden developers). I don’t think it happens that frequently, but in this case, I would recreate the container using the existing volumes and everything should function the exact way it always has.

      1. Great! Thank you for the quick reply.

        Since I’m fairly newbie to the Docker world and just to be clear: when you say recreate the container, you mean stop/kill/remove the existing container and then create a new Bitwarden container from scratch (following for example your guide https://www.wundertech.net/how-to-self-host-bitwarden-on-a-raspberry-pi/) and map the existing volume, right?

        1. That is correct! You can leave the old container there as a backup until you verify the new container is working.

          1. Many thanks Frank!

            All went well, my new Bitwarden (powered by Vaultwarden) is up and running. I appreciate your help and your tutorials. Keep up the good work!

          2. Glad to hear you got it working!

  5. Stopping containers and …..RECREATE option is MISSING !
    Using latest 2.6.2 portainer.
    Has the option been removed or does it maybe only appear on some containers ?
    Not there for transmission, yacht, ghost.
    Really confused with how to update containers via portainer.

    1. As far as I know, the option should be there. Are the containers reporting as “stopped” when you try and recreate them and is only one selected?

Leave a Reply

Close Menu