
How to update a Docker Container like Portainer?
Update a Docker Container
There is a Portainer update available as we can see in the bottom left of the Portainer webinterface:

Let's try to update to the latest version! π
Check out these sources for more information, requirements and instructions:
Source:Β https://www.portainer.io/
Documentation:Β https://docs.portainer.io/start/install-ce / https://docs.portainer.io/start/upgrade/docker
Table of Contents
Update steps and result target
Since Portainer is deployed as a Docker Container we cannot use it to manage "itself". We need to take some action ourself. πͺ
- Stop the Portainer container when running and remove Portainer container
- Download and deploy the latest version of the Portainer image
- Check if Portainer is working and running on the latest version
Stop the Portainer container when running
List all running containers:
sudo docker container lsπ Example output πThe Portainer container is running.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a4953c7db586 louislam/uptime-kuma:1 "/usr/bin/dumb-init β¦" 12 days ago Up 2 hours (healthy) 0.0.0.0:3001->3001/tcp, :::3001->3001/tcp uptime-kuma
730e9777e166 portainer/portainer-ce:latest "/portainer" 3 weeks ago Up 2 hours 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp, 9000/tcp portainerLet's stop the container called portainer.
sudo docker stop portainerExample output πThe only output is the name of the container: portainer. This is the expected output.
portainerCheck if the container is still running or not
sudo docker container lsπ Example output πThe Portainer container is not running anymore:
techfossa@techfossa-demo-01:~$ sudo docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a4953c7db586 louislam/uptime-kuma:1 "/usr/bin/dumb-init β¦" 12 days ago Up 3 hours (healthy) 0.0.0.0:3001->3001/tcp, :::3001->3001/tcp uptime-kuma
We will now remove the Portainer container
sudo docker rm portainerπ Example output πThe only output is the name of the container: portainer. This is the expected output.
portainerPull and deploy
Download the latest Portainer image version:
sudo docker pull portainer/portainer-ce:latestπ Example output π A new image is downloaded:
techfossa@techfossa-demo-01:~$ sudo docker pull portainer/portainer-ce:latest
latest: Pulling from portainer/portainer-ce
a036d31327aa: Pull complete
51b7d20b40ba: Pull complete
d40df14c1d7a: Pull complete
8215717c7c10: Pull complete
542669febe7c: Pull complete
6c27c7f45b54: Pull complete
09b63b7105b3: Pull complete
11cb7599cbba: Pull complete
5ce017686e14: Pull complete
9055ac8e891a: Pull complete
4f4fb700ef54: Pull complete
Digest: sha256:fcd79694da039537aa4c287f0e0a140f6d356fec3128774523e77fc66e0b6de3
Status: Downloaded newer image for portainer/portainer-ce:latest
docker.io/portainer/portainer-ce:latest
techfossa@techfossa-demo-01:~$Deploy the latest version of the Portainer image by entering the original run command from our previous post:
sudo docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=unless-stopped -v /var/run/docker.sock:/var/run/docker.sock -v /data/dockerdata/portainer/data:/data portainer/portainer-ce:latestπ Example output π This is the expected output.
techfossa@techfossa-demo-01:~$ sudo docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=unless-stopped -v /var/run/docker.sock:/var/run/docker.sock -v /data/dockerdata/portainer/data:/data portainer/portainer-ce:latest
5b44c37368616f1d95d8e73794dafe4c52a3f3a418f1c6a11dd37c4c8777ed80
techfossa@techfossa-demo-01:~$ Check Portainer
No issue there, the new version of Portainer is now showing in the bottom left corner:
We have now completed the update from version 2.21.0 to 2.21.2. π
