brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: update Portainer by pulling the lts tag and recreating the container

Portainer
~/tips/tip-portainer-update-container

docker stop portainer

Shows how to update Portainer by replacing its container while the data volume stays in place.

Portainer has no update button in the app. You replace the container, and your data stays because it lives in a volume.

The docs give these steps for Docker standalone:

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

The portainer_data volume mounted at /data holds the settings, so the new container picks them up. Port 8000 is only for Edge Agents, and the docs say you can drop it if you do not use any.

Caveats: back up first. And keep your agents on the same version as the server, so if the server is 2.45.3, the agents must be too. Check that your original run command used the same ports and volume names, because a new container with different mounts looks like a blank Portainer.

After it starts, log in at https://your-server:9443 and check that the version number changed and the update notice is gone. If you installed Portainer with a Compose file, update the image tag there instead and redeploy it the way you normally do, so you do not end up with two containers fighting over the same ports.

Further reading: Upgrade Portainer on Docker Standalone, On this site: Portainer backs up its own settings with one click, so take one before every update, On this site: you can only restore a Portainer backup on a fresh install, during setup

More Portainer tips Choose Polling in a Portainer GitOps update when your Git host can't reach Portainer Put Portainer environments in groups and give users access to a whole group Portainer's Edge Agent checks in every 5 seconds, and you can change that docker run -d -p 9001:9001 --name portainer_agent --restart=always \ Deploy the container → Replace All Portainer tips (28) All topics

Link