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: give containers made outside Portainer an owner with an access-control label

Portainer
~/tips/tip-portainer-access-control-labels

docker run -d --label io.portainer.accesscontrol.teams=devs nginx

Lets a team see containers started outside Portainer through a label, instead of administrators only.

Portainer access control applies to what Portainer deploys. Containers you start from the command line show up as external, and they are a special case.

Resources deployed outside Portainer are marked external and default to administrators only. The docs say you can change that with labels on the container:

docker run -d --label io.portainer.accesscontrol.teams=devs nginx

There are three labels. io.portainer.accesscontrol.public gives access to all users. io.portainer.accesscontrol.teams restricts it to the named teams. io.portainer.accesscontrol.users restricts it to named users, and you can combine it with the teams label.

The caveat is the precedence. The public label wins over the team and user labels, so one stray public label opens the container to everyone. Also, access control covers Docker and Swarm resources except images, and resources created by a stack inherit the settings of the stack.

I would use this for the one-off container you started by hand and now want a colleague or family member to see, without making them an administrator. Set the label when you create the container, because labels cannot be added to a running container without recreating it.

Further reading: Access control, On this site: hide the containers you never want to see in Portainer with –hide-label, On this site: switch on Force HTTPS only in Portainer, but test 9443 first

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