create the network:
docker network create --driver=overlay --subnet=10.0.2.0/24 portainer
create the file portainer-stack.yml, with content:
version: '3.3'
services:
agent:
image: portainer/agent
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/docker/volumes:/var/lib/docker/volumes
networks:
- portainer
deploy:
mode: global
placement:
constraints:
- node.platform.os == linux
server:
image: portainer/portainer-ce
volumes:
- /containers/portainer/:/data
networks:
- traefik-network
- portainer
command:
-H tcp://tasks.agent:9001 --tlsskipverify
deploy:
mode: replicated
replicas: 1
placement:
constraints:
- node.role == manager
labels:
- traefik.enable=true
- traefik.docker.network=traefik-network
- traefik.constraint-label=traefik-network
- traefik.http.routers.portainer-http.rule=Host(`portainer.krolaki.eu`)
- traefik.http.routers.portainer-http.entrypoints=http
- traefik.http.routers.portainer-http.middlewares=https-redirect
- traefik.http.routers.portainer-https.rule=Host(`portainer.krolaki.eu`)
- traefik.http.routers.portainer-https.entrypoints=https
- traefik.http.routers.portainer-https.tls=true
- traefik.http.services.portainer.loadbalancer.server.port=9000
networks:
traefik-network:
external: true
portainer-agent:
external: true