Skip to content

Instantly share code, notes, and snippets.

@omartrigui
Last active June 5, 2019 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omartrigui/9b37a1822bb0a6410a6ede9dce725507 to your computer and use it in GitHub Desktop.
Save omartrigui/9b37a1822bb0a6410a6ede9dce725507 to your computer and use it in GitHub Desktop.
Multi http sub-domains with Traefik
version: '3'
services:
web1:
image: emilevauge/whoami
container_name: web1
labels:
- "traefik.enable=true"
- "traefik.backend=whoami1"
- "traefik.frontend.rule=Host:web1.example.com"
- "traefik.port=80"
restart: always
networks:
- traefik
networks:
traefik:
external:
name: traefik
version: '3'
services:
web2:
image: emilevauge/whoami
container_name: web2
labels:
- "traefik.enable=true"
- "traefik.backend=whoami2"
- "traefik.frontend.rule=Host:web2.example.com"
- "traefik.port=80"
restart: always
networks:
- traefik
networks:
traefik:
external:
name: traefik
version: '3'
services:
traefik:
image: traefik:alpine
command: --web --docker --logLevel=DEBUG
container_name: traefik
ports:
- "80:80"
- "8080:8080"
restart: always
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "./traefik.toml:/etc/traefik/traefik.toml"
networks:
- traefik
networks:
traefik:
external:
name: traefik
$ tree
.
├── docker-compose.web1.yml
├── docker-compose.web2.yml
├── docker-compose.yml
└── traefik.toml
defaultEntryPoints = ["http"]
[entryPoints]
[entryPoints.http]
address = ":80"
[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "example.com"
exposedbydefault = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment