Portainer: easy updating your Docker instance

Diego Betto
Diego Betto
Posted underDevelop

Portainer is a really nice tool to manage your Docker containers, volumes and networks.

One of the things that may scare you at the beginning is how to update Portainer.
It is really simple and you should not lose any data.

I use linux Ubuntu/Debian so in your case things may be different but should be easy to adapt the script

You can create a simple script like this

#!/bin/bash sudo docker pull portainer/portainer-ce sudo docker stop portainer sudo docker rm portainer sudo docker run --name portainer --restart=unless-stopped -d -p 8000:8000 -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
Code language: JavaScript (javascript)

It will:

  • update your local Portainer image
  • stop the container
  • remove it (not the volume with data)
  • start the new container

You can place it in your ~/.local/bin with the name update-portainer and then add permission to execute it (like chmod +x ~/.local/bin/update-portainer)

Now you can simply run update-portainer in your bash and your local Portainer container will be updated.

Easy. Have a nice day!

More Stories

React: useContext with useState

Diego Betto
Diego Betto

Cloudflare outage and strange Google SERPs

On June 21 Cloudflare suffered an outage, as they report: A change to the network configuration in those locations caused an outage which started at 06:27 UTC. At 06:58 UTC the first data center was brought back online and by 07:42 UTC all data centers were online and working correctly. Blog, So now everything… Continue reading Cloudflare outage and strange Google SERPs

Diego Betto
Diego Betto