Setup
https://docs.portainer.io/start/install-ce/server/docker/linux Find out the latest tag at https://hub.docker.com/r/portainer/portainer-ce/tags
docker network create portainer_net
docker run -d --name ct-portainer \
-p 9443:9443 --network portainer_net --restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /srv/docker/volumes/portainer/data:/data \
portainer/portainer-ce:ltsNOTE
Port 9443 need to be exposed even after NPM/portainer.one137.dev has been configured, because the NPM stack cannot be edited from proxied https://portainer.one137.dev
Port 8000 is optional and only required if using Edge Compute features with Edge Agents
UI at https://192.168.137.13:9443
Update
docker stop ct-portainer
docker rm ct-portainer
docker pull portainer/portainer-ce:lts
# run `docker run` command abovePrereq for import/export below
Create API token:
- Click account name (top-right) > My account
- Access tokens > Add access token > Copy and save token
Install jq
sudo apt install jq
Import stacks from CLI
Make sure you have a Portainer Access Token configured.
curl -k -X POST "https://localhost:9443/api/stacks/create/standalone/file?endpointId=2" -H "X-API-Key: $PORTAINER_TOKEN" -F 'Name=50-cloudflared' -F '[email protected]' -F "Env=$(cat ./50-cloudflared.env.json)"
where 50-cloudflared.secrets.env.json looks like:
[{ "name": "CLOUDFLARED_TOKEN", "value": "ey..." }]
Automate:
PORTAINER_API_TOKEN=<token> ./import_stacks.shwhere script is: https://github.com/one137/dockerhost-stacks/blob/main/import_stacks.sh
Export all stacks
./export_all_stacks.sh : https://github.com/one137/dockerhost-stacks/blob/main/export_all_stacks.sh