version: '3.5' services: traefik: image: traefik:1.7 command: --web --docker --docker.domain=app.test --logLevel=DEBUG depends_on: # our setup relies on the 3 apps running. Trying to spin up traefik will bring up those too - "app1" - "app2" - "app3" ports: # access this with the correct Host header to access the respective container - "80:80" # management UI - "8080:8080" volumes: # traefik does its magic by reading information about running containers from the docker socket - /var/run/docker.sock:/var/run/docker.sock - /dev/null:/traefik.toml networks: outside-world: internal-network: # app1, app2 and app3 are Caddy instances listening to port 80 and serving an index.html. app1: build: context: . dockerfile: app1-Dockerfile networks: internal-network: # the aliases are not required, but are useful if the applications want to internally # reference each other by host name aliases: - "app1.test" labels: - "traefik.port=80" - "traefik.frontend.rule=Host:app1.test" app2: build: context: . dockerfile: app2-Dockerfile networks: internal-network: aliases: - "app2.test" labels: - "traefik.port=80" - "traefik.frontend.rule=Host:app2.test" app3: build: context: . dockerfile: app3-Dockerfile networks: internal-network: aliases: - "app3.test" labels: - "traefik.port=80" - "traefik.frontend.rule=Host:app3.test" networks: # everything that is *only* on "internal network" cannot talk to WAN internal-network: internal: true # add this network to a container to make it talk to the rest of the world outside-world: