Updating on Docker Swarm

Always match the agent version to the Portainer Server version. In other words, when you're installing or updating to Portainer 2.28.0 make sure all of the agents are also on version 2.28.0.

To update the Portainer Server and the agents on Docker Swarm, first run the following command on the manager node of your Docker Swarm cluster:

docker service ls 

Make note of the service names for Portainer. You will need them later.

ID             NAME                    MODE         REPLICAS   IMAGE                          PORTS
tb9gtxc647fw   portainer-agent_agent   global       3/3        portainer/agent:2.27.2
m3a3mtuy55ed   portainer_portainer     replicated   1/1        portainer/portainer-ee:2.27.2  *:8000->8000/tcp, *:9000->9000/tcp

To update Portainer Server to the most recent version, run one of the sets of commands below depending on your edition of Portainer (replace the portainer_portainer service name if your setup differs):

docker pull portainer/portainer-ee:lts
docker service update --image portainer/portainer-ee:sts --publish-add 9443:9443 --force portainer_portainer

To update the Portainer Agent to the latest version, run the commands below (replace the portainer_agent service name if your setup differs):

docker pull portainer/agent:sts
docker service update --image portainer/agent:sts --force portainer_agent 

This will deploy the newest version of Portainer and the agent across your swarm and upgrade the Portainer database to match.

When this is finished, go to https://your-server-address:9443 or http://your-server-address:9000 and log in. You should notice that the update notification has disappeared and the version number has been updated.

Last updated

Was this helpful?