tips
28 tips Portainer
One command, setting or habit at a time about Portainer: what it does, the line to copy and a caveat or two.
Access and security 6
-
Organizes environments into groups, so access and tags apply to all of them at once.
-
Lets a Portainer agent accept any Portainer server that knows a shared secret, instead of only the first.
docker run -d -p 9001:9001 --name portainer_agent --restart=always \ -
Lets a team see containers started outside Portainer through a label, instead of administrators only.
docker run -d --label io.portainer.accesscontrol.teams=devs nginx -
Logs Portainer in to Docker Hub so it can pull private images and many images.
-
Resets the Portainer admin password by running a helper container against the data volume.
docker stop portainer -
Sets the first admin password from a file when Portainer starts, so you skip the setup page.
docker run -d -p 9443:9443 --name portainer \
Interface and files 5
-
Sets how often Edge Agents call home to the Portainer server.
-
Makes the published port links in Portainer open the real address of your Docker host.
Public IP: 192.168.1.20 -
Lets you view, upload and download the files in a Docker volume from the Portainer web interface.
-
Changes how often Portainer refreshes the summary data on its home page.
--snapshot-interval 1m -
Hides containers that carry a chosen label from the Portainer container list.
docker run -d ... portainer/portainer-ce:lts -l owner=acme
Containers and images 4
-
Explains that editing a container in Portainer builds a new one and what gets lost on the way.
Deploy the container → Replace -
Builds a Docker image straight from the Portainer interface and shows the limits of COPY.
FROM alpine:3.20 -
Uses the display options of the container log page to find a specific time or message.
docker logs --timestamps --tail 1000 --since 30m mycontainer -
Opens a shell inside a container from the browser and explains the Alpine exception.
docker exec -it -u root mycontainer /bin/ash
Stacks 3
-
Replaces Portainer's built-in app template list with a JSON file that you host.
docker run -d ... portainer/portainer-ce:lts \ -
Copies a stack to another Portainer environment, though its volume data stays where it was.
docker run --rm -v myvolume:/data -v $(pwd):/backup alpine \ -
Explains how environment variables reach containers in a Portainer stack through stack.env.
- stack.env
Webhooks 3
-
Redeploys a single Portainer-managed container with a fresh image when something calls its URL.
curl -X POST "https://portainer.example.com:9443/api/webhooks/638e6967-ef77-4906-8af8-236800621360" -
Passes values to a stack through the webhook URL so one stack file serves several environments.
image: repository/image:${SERVICE_TAG:-stable} -
Lets a registry or CI job redeploy a Portainer stack, optionally with another image tag.
curl -X POST "https://portainer.example.com:9443/api/stacks/webhooks/638e6967-ef77-4906-8af8-236800621360?tag=1.2.0"
Git in Portainer 2
-
Lets Portainer check your Git repository on a timer, so no inbound webhook is needed.
-
Shows where to find or preset the one-time token that a fresh Portainer needs.
docker logs portainer 2>&1 | grep setup_token
Updates and backups 2
-
Shows how to update Portainer by replacing its container while the data volume stays in place.
docker stop portainer -
Downloads a password-protectable archive of Portainer's own configuration so you can rebuild it later.
Compose 1
-
Adds fill-in fields to a Portainer template so the same compose file can be deployed with different values.
services:
Nginx Proxy Manager 1
-
Keeps the Portainer service on the Swarm node where its data volume is stored.
docker node ls
Templates 1
-
Saves the compose file of a running stack as a reusable template.
Stacks > mystack > Create template from stack
Nothing in this filter yet.