Skip to content

Instantly share code, notes, and snippets.

@YourFriendCaspian
Created March 29, 2019 23:34
Show Gist options
  • Save YourFriendCaspian/859a31b05c49f12e66d77e2cfb11f2b9 to your computer and use it in GitHub Desktop.
Save YourFriendCaspian/859a31b05c49f12e66d77e2cfb11f2b9 to your computer and use it in GitHub Desktop.
traefik:
container_name: traefik
domainname: homedomain.lan
image: traefik
restart: unless-stopped
# Note I opt to whitelist certain apps for exposure to traefik instead of auto discovery
# use `--docker.exposedbydefault=true` if you don't want to have to do this
command: "--web --docker --docker.domain=homedomain.lan --docker.exposedbydefault=false --logLevel=DEBUG"
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /dev/null:/traefik.toml
networks:
- default
- discovery
dns:
- 192.168.1.50
- 192.168.1.1
pihole:
container_name: pihole
domainname: homedomain.lan
image: pihole/pihole:latest
dns:
- 127.0.0.1
- 1.1.1.1
ports:
- '0.0.0.0:53:53/tcp'
- '0.0.0.0:53:53/udp'
- '0.0.0.0:67:67/udp'
- '0.0.0.0:8053:80/tcp'
volumes:
- ./etc-pihole/:/etc/pihole/
- ./etc-dnsmasqd/:/etc/dnsmasq.d/
# run `touch ./pihole.log` first unless you like errors
# - ./pihole.log:/var/log/pihole.log
environment:
ServerIP: 192.168.1.50
PROXY_LOCATION: pihole
VIRTUAL_HOST: pihole.homedomain.lan
VIRTUAL_PORT: 80
TZ: 'America/Chicago'
# WEBPASSWORD:
restart: unless-stopped
labels:
# required when using --docker.exposedbydefault=false
- "traefik.enable=true"
# https://www.techjunktrunk.com/docker/2017/11/03/traefik-default-server-catch-all/
- "traefik.frontend.rule=HostRegexp:pihole.homedomain.lan,{catchall:.*}"
- "traefik.frontend.priority=1"
- "traefik.backend=pihole"
- "traefik.port=80"
networks:
# Discovery is manually created to avoid forcing any order of docker-compose stack creation (`docker network create discovery`)
# allows other compose files to be seen by proxy
# Not required if you aren't using multiple docker-compose files...
discovery:
external: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment