Skip to content

Instantly share code, notes, and snippets.

@wader
Last active January 15, 2019 03:12
Show Gist options
  • Save wader/fd6aa0c5cc2e67da0c3c846573a8afc1 to your computer and use it in GitHub Desktop.
Save wader/fd6aa0c5cc2e67da0c3c846573a8afc1 to your computer and use it in GitHub Desktop.
traefik, docker, let's encrypt, http to https redirect
version: '2'
services:
traefik:
restart: unless-stopped
image: traefik
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./traefik.toml:/traefik.toml
- ./acme:/acme
# to enable stats dashboard, also enable web backend in traefik.toml
# labels:
# - traefik.enable=true
# - traefik.docker.network=traefik-proxy
# - traefik.port=8080
# - traefik.frontend.rule=Host:traefik.domain.com
networks:
# create this netowork with: docker network create traefik-proxy
- traefik-proxy
networks:
traefik-proxy:
external:
name: traefik-proxy
version: '2'
services:
webapp:
restart: unless-stopped
build: .
labels:
- traefik.enable=true
- traefik.docker.network=traefik
- traefik.port=80
- traefik.frontend.rule=Host:example.com
networks:
- traefik-proxy
networks:
traefik-proxy:
external:
name: traefik-proxy
#debug = true
defaultEntryPoints = ["http", "https"]
accessLogsFile = "/proc/self/fd/1"
#[web]
# address = ":8080"
#[web.auth.basic]
# users = ["traefik:generate-with-htpasswd"]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[acme]
email = ""
storage = "/acme/acme.json"
entryPoint = "https"
OnHostRule = true
[docker]
endpoint = "unix:///var/run/docker.sock"
exposedbydefault = false
watch = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment