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: pin portainer to the node that holds portainer_data on a Swarm with node.hostname

Portainer
~/tips/tip-portainer-swarm-pin-node-hostname

docker node ls

Keeps the Portainer service on the Swarm node where its data volume is stored.

With several Swarm managers, Portainer can start on another node and look like a fresh install. A placement constraint stops that.

docker node ls
docker service update --constraint-add 'node.hostname==manager1' portainer_portainer

The data volume lives on one node. When the service is rescheduled to a manager without it, Portainer starts empty and asks for a new admin. The documentation suggests a constraint on node.hostname with the name of the node that has the data.

The service is called portainer_portainer if you deployed the recommended stack under the name portainer. You can also set it in the stack file under deploy.placement.constraints.

Further reading: Portainer docs: How can I ensure Portainer's configuration is retained?

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