version: '3.8' services: portainer: container_name: portainer image: portainer/portainer-ce command: -H unix:///var/run/docker.sock volumes: - /var/run/docker.sock:/var/run/docker.sock - portainer_data:/data networks: - portainer-frontend restart: unless-stopped expose: - 9000 labels: - traefik.enable=true - traefik.http.routers.portainer.rule=Host(`${HOST_WWW}.${DOMAIN}`) && PathPrefix(`${PATH_PORTAINER}`) - traefik.http.routers.portainer.entrypoints=https - traefik.http.routers.portainer.tls=true - traefik.http.services.portainer.loadbalancer.server.port=9000 - traefik.http.routers.portainer.middlewares=portainerRedir,portainerPStrip - traefik.http.middlewares.portainerPStrip.stripprefix.prefixes=${PATH_PORTAINER} - traefik.http.middlewares.portainerRedir.redirectregex.regex=^(.*)${PATH_PORTAINER}$$ - traefik.http.middlewares.portainerRedir.redirectregex.replacement=$${1}${PATH_PORTAINER}/ - traefik.docker.network=portainer-frontend networks: portainer-frontend: name: portainer-frontend volumes: portainer_data: