Help getting HA running with Traefik

Sure. Presumably you’ve created the docker-compose.yml, traefik.toml, and acme.json files (and changed the permission on the acme.json file).

mkdir -p ~/docker/traefik

touch ~/docker/traefik/docker-compose.yml
touch ~/docker/traefik/acme.json && chmod 600 ~/docker/traefik/acme.json
touch ~/docker/traefik/traefik.toml

I created a network for traefik and the containers called 'proxy'

docker network create proxy


And here’s the code that works for me:

docker-compose.yml

version: '3'

networks:
  proxy:
    external: true

services:
  reverse-proxy:
    container_name: reverse-proxy
    image: traefik
    restart: always
    command: --web --docker
    networks:
      - proxy       
    ports:
      - 8080:8080
      - 80:80
      - 443:443
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ~/docker/traefik/traefik.toml:/traefik.toml
      - ~/docker/traefik/acme.json:/acme.json

  homeassistant:
    image: homeassistant/home-assistant
    container_name: home-assistant
    restart: unless-stopped
    networks:
      - proxy
    ports:
      - 8123
    volumes:
     - ~/docker/homeassistant_config:/config
     - /etc/localtime:/etc/localtime:ro
    labels:
      - "traefik.backend=home-assistant"
      - "traefik.docker.network=proxy"
      - "traefik.frontend.rule=Host:MY-DOMAIN.COM"
      - "traefik.enable=true"
      - "traefik.port=8123"
      - "traefik.default.protocol=http"

**traefik.toml**
debug = false

logLevel = "ERROR"
defaultEntryPoints = ["https","http"]

[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"
  [entryPoints.https]
  address = ":443"
  [entryPoints.https.tls]

[retry]

[web]
address = ":8080"

[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "docker.localhost"
watch = true
exposedbydefault = false

[acme]
email = "MY-EMAIL-ADDRESS"
storage = "acme.json"
entryPoint = "https"
OnHostRule = true
[acme.httpChallenge]
entryPoint = "http"

[[acme.domains]]
  main = "MY-DOMAIN.COM"
4 Likes