Skip to content

Instantly share code, notes, and snippets.

@palazzem
Created March 22, 2020 17:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save palazzem/621bef747488e79b1ad7c34d37a9b9b5 to your computer and use it in GitHub Desktop.
Save palazzem/621bef747488e79b1ad7c34d37a9b9b5 to your computer and use it in GitHub Desktop.
Traefik in network_mode: host
version: "3.7"
services:
traefik:
image: "traefik:v2.2"
container_name: "traefik"
command:
- "--accesslog=true"
- "--api.insecure=true"
- "--entrypoints.web.address=:80"
- "--providers.docker=true"
- "--providers.file=true"
- "--providers.file.filename=/etc/traefik/rules.yaml"
ports:
- "80:80"
- "8080:8080"
volumes:
- "./rules.yaml:/etc/traefik/rules.yaml"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
whoami:
image: "containous/whoami"
container_name: "simple-service"
network_mode: host
command:
- "--port=32000"
labels:
- "traefik.enable=false"
http:
routers:
whoami:
rule: Host(`your.domain.com`)
entrypoints:
- web
service: whoami
services:
whoami:
loadBalancer:
servers:
# 172.17.0.1 is the `docker0` interface
- url: 'http://172.17.0.1:32000'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment