traefik/docker-compose.yml
version: '2'
services:
proxy:
image: traefik
networks:
- webgateway
ports:
- "80:80"
- "443:443"
restart: always
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "./traefik.toml:/traefik.toml"
labels:
- "traefik.backend=proxy"
- "traefik.frontend.rule=Host:traefik.mydomain.com"
- "traefik.port=8080"
networks:
webgateway:
driver: bridge
traefik/traefik.toml
# defaultEntryPoints must be at the top because it should not be in any table below
#defaultEntryPoints = ["http", "https"]
defaultEntryPoints = ["http"]
[web]
# Port for the status page
address = ":8080"
# Entrypoints, http and https
[entryPoints]
# http should be redirected to https
[entryPoints.http]
address = ":80"
#[entryPoints.http.redirect]
#entryPoint = "https"
# https is the default
#[entryPoints.https]
#address = ":443"
#[entryPoints.https.tls]
# Enable ACME (Let's Encrypt): automatic SSL
#[acme]
# caServer = "https://acme-staging.api.letsencrypt.org/directory"
#email = "[email protected]"
#storage = "acme.json" # or "traefik/acme/account" if using KV store
#entryPoint = "https"
#onDemand = false
#OnHostRule = true
[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "mydomain.com"
watch = true
#exposedbydefault = false
app/docker-compose.yml
version: "2"
services:
api:
image:
networks:
- web
labels:
- "traefik.backend=api"
- "traefik.port=8082"
- "traefik.frontend.rule=Path:/rpc"
upload:
image:
networks:
- web
labels:
- "traefik.backend=upload"
- "traefik.port=5052"
- "traefik.frontend.rule=Path:/upload"
front:
image:
networks:
-web
labels:
- "traefik.backend=front"
- "traefik.port=80"
- "traefik.frontend.rule=Host:front.mydomain.com"
networks:
web:
external:
name: traefik_webgateway