2020-04-09 22:52:11 +00:00
|
|
|
# Portainer in docker
|
|
|
|
|
|
|
|
###### guide by example
|
|
|
|
|
2020-04-25 23:48:23 +00:00
|
|
|
![logo](https://i.imgur.com/QxnuB1g.png)
|
2020-04-09 22:52:11 +00:00
|
|
|
|
2020-04-25 23:48:23 +00:00
|
|
|
# Purpose
|
2020-04-09 22:52:11 +00:00
|
|
|
|
2020-04-27 21:01:48 +00:00
|
|
|
User friendly overview and managment of the running containers,
|
2020-04-29 00:16:57 +00:00
|
|
|
networks, volumes, images,... the work.
|
2020-04-09 22:52:11 +00:00
|
|
|
|
2020-04-25 23:48:23 +00:00
|
|
|
# Files and directory structure
|
|
|
|
|
|
|
|
```
|
2020-05-01 09:38:43 +00:00
|
|
|
/home/
|
|
|
|
└── ~/
|
|
|
|
└── docker/
|
|
|
|
└── portainer/
|
|
|
|
├── portainer_data/
|
|
|
|
├── .env
|
|
|
|
└── docker-compose.yml
|
2020-04-25 23:48:23 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
# docker-compose
|
|
|
|
|
|
|
|
`docker-compose.yml`
|
|
|
|
```yml
|
|
|
|
version: '2'
|
|
|
|
|
|
|
|
services:
|
|
|
|
portainer:
|
|
|
|
image: portainer/portainer
|
|
|
|
container_name: portainer
|
|
|
|
hostname: portainer
|
|
|
|
command: -H unix:///var/run/docker.sock
|
|
|
|
restart: unless-stopped
|
2020-04-26 00:43:30 +00:00
|
|
|
env_file: .env
|
2020-04-25 23:48:23 +00:00
|
|
|
volumes:
|
|
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
|
|
- ./portainer_data:/data
|
|
|
|
|
|
|
|
networks:
|
|
|
|
default:
|
|
|
|
external:
|
|
|
|
name: $DEFAULT_NETWORK
|
|
|
|
```
|
|
|
|
|
|
|
|
`.env`
|
|
|
|
```bash
|
|
|
|
# GENERAL
|
|
|
|
MY_DOMAIN=blabla.org
|
|
|
|
DEFAULT_NETWORK=caddy_net
|
|
|
|
TZ=Europe/Prague
|
|
|
|
```
|
|
|
|
|
|
|
|
# reverse proxy
|
|
|
|
|
2020-05-01 09:51:20 +00:00
|
|
|
Caddy v2 is used, details
|
|
|
|
[here](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/caddy_v2).</br>
|
2020-04-25 23:48:23 +00:00
|
|
|
|
|
|
|
`Caddyfile`
|
|
|
|
```
|
|
|
|
portainer.{$MY_DOMAIN} {
|
|
|
|
reverse_proxy portainer:9000
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
# Update
|
|
|
|
|
|
|
|
* [watchtower](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/watchtower) updates the image automaticly
|
|
|
|
|
|
|
|
* manual image update</br>
|
2020-04-09 22:52:11 +00:00
|
|
|
`docker-compose pull`</br>
|
|
|
|
`docker-compose up -d`</br>
|
|
|
|
`docker image prune`
|