This install assumes that Docker has been installed previously, and extends the Docker stack created for the Traefik Reverse Proxy.
Portainer is a container management platform allowing the deployment, configuration, troubleshooting and securing containers on Docker. In our case it is primarily used for monitoring containers, as deployment is done via Docker Compose.
Install Portainer
Create folder for portainer data:
1
2
3
cd ~/docker
mkdir portainer
mkdir portainer/data
Add the following service definition to dc-portainer.yml in docker root folder
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
version: "3.9"
# NETWORKS ####################################################
networks:
traefik_proxy:
external: true
# SERVICES ####################################################
services:
portainer:
container_name: portainer
image: portainer/portainer-ce:latest
#
restart: always
security_opt:
- no-new-privileges:true
#
networks:
- traefik_proxy
#
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- $DOCKERDIR/portainer/data:/data
environment:
- TZ=$TZ
#
labels:
- "traefik.enable=true"
# HTTPS
- "traefik.http.routers.portainer-secure.entrypoints=https"
- "traefik.http.routers.portainer-secure.rule=Host(`portainer.$DOMAINNAME_CLOUD_SERVER`)"
- "traefik.http.routers.portainer-secure.tls=true"
# Services
- "traefik.http.routers.portainer-secure.service=portainer"
- "traefik.http.services.portainer.loadbalancer.server.port=9000"
From the Docker root folder, run this command to build the container. Ignore any reference to orphan containers, just adding another container to the stack.
1
sudo docker compose -f dc-portainer.yml up -d
In browser, go to the web interface for portainer, portainer.bbproj.org (or use the IP address and port 9443)
- Enter a new username = admin and password = [STRONGBOX], click Create
- Clean up image from Docker test
- Go to Containers, delete “hello-world” container (tick container & click Remove)
- Go to Images, delete “hello-world:latest” image
Update Container Using Portainer
- Click on container link (Name) to be updated
- In Container details screen, click Stop button to stop the container
- Once stopped, click Recreate button
- Toggle “Re-pull image” and click Recreate
- Once completed, restart the container
Resources
- Portainer documentation