portainer/portainer-compose

Can't get HTTPS to work with Traefik (Bad Gateway)

flymia opened this issue · 0 comments

Hi there,
I used the sample docker-compose.yml to get it to work with Traefik. Works great on port 80, but I need it on port 443, obviously because of security reasons.

How to achieve this?

I use the following but it does not work. I get a 502 Bad Gateway.

version: "2"

services:
  portainer:
    image: portainer/portainer
    restart: always
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - portainer_data:/data
    networks:
      - proxy
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.portainer.entrypoints=http"
      - "traefik.http.routers.portainer.rule=Host(`example.com`)"
      - "traefik.http.middlewares.portainer-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.portainer.middlewares=portainer-https-redirect"
      - "traefik.http.routers.portainer-secure.entrypoints=https"
      - "traefik.http.routers.portainer-secure.rule=Host(`example.com`)"
      - "traefik.http.routers.portainer-secure.tls=true"
      - "traefik.http.routers.portainer-secure.tls.certresolver=http"
      - "traefik.http.routers.portainer-secure.service=portainer"
      - "traefik.http.services.portainer.loadbalancer.server.port=80"
      - "traefik.docker.network=proxy"
      - "traefik.port=9000"

volumes:
  portainer_data:
networks:
  proxy:
    external: true