mirror of
https://github.com/DoTheEvo/selfhosted-apps-docker
synced 2024-11-05 00:00:47 +00:00
.. | ||
readme.md |
Portainer in docker
guide-by-example
Purpose
Web UI for overview and management of docker environment.
Portainer is a lightweight management web UI, that allows to easily manage docker containers, networks, volumes, images,... the work.
In my use it is mostly information tool, rather than a management tool.
Files and directory structure
/home/
└── ~/
└── docker/
└── portainer/
├── portainer-data/
├── .env
└── docker-compose.yml
portainer-data/
- a directory where portainer stores its peristent data.env
- a file containing environment variables for docker composedocker-compose.yml
- a docker compose file, telling docker how to run the containers
You only need to provide the files.
The directory is created by docker compose on the first run.
docker-compose
docker-compose.yml
version: '2'
services:
portainer:
image: portainer/portainer-ce
container_name: portainer
hostname: portainer
command: -H unix:///var/run/docker.sock
restart: unless-stopped
env_file: .env
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./portainer-data:/data
networks:
default:
external:
name: $DOCKER_MY_NETWORK
.env
# GENERAL
MY_DOMAIN=example.com
DOCKER_MY_NETWORK=caddy_net
TZ=Europe/Bratislava
reverse proxy
Caddy v2 is used, details
here.
Caddyfile
portainer.{$MY_DOMAIN} {
reverse_proxy portainer:9000
}
Update
Watchtower updates the image automatically.
Manual image update:
docker-compose pull
docker-compose up -d
docker image prune
Backup and restore
Backup
Using borg that makes daily snapshot of the entire directory.
Restore
- down the portainer container
docker-compose down
- delete the entire portainer directory
- from the backup copy back the portainer directory
- start the container
docker-compose up -d