Skip to content

Instantly share code, notes, and snippets.

@pkhabazi
Created January 22, 2020 08:45
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkhabazi/51e9049b643d71c025c0d65df5792b3f to your computer and use it in GitHub Desktop.
Save pkhabazi/51e9049b643d71c025c0d65df5792b3f to your computer and use it in GitHub Desktop.
Docker compose with macvlan example
version: "3.6"
networks:
macvlan_network:
driver: macvlan
driver_opts:
parent: eth01
ipam:
config:
- subnet: 192.168.1.0/24
services:
# Pihole DNS server
pihole:
container_name: pihole
domainname: pkm.localhost
image: pihole/pihole:latest
hostname: pihole
networks:
# Same name of network defined above
macvlan_network:
ipv4_address: 192.168.1.2
mac_address: d0:ca:ab:cd:ef:02 # Random MAC address (optional)
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'
environment:
TZ: 'Europe/Amsterdam'
WEBPASSWORD: "YOURSECUREPASSWORD"
ServerIP: 192.168.1.2
VIRTUAL_PORT: 80
# Volumes store your data between container upgrades
volumes:
- ${USERDIR}/docker/pihole/files/volume:/etc/pihole/
- ${USERDIR}/docker/pihole/files/config:/etc/dnsmasq.d/
- ${USERDIR}/docker/shared:/shared
dns:
- 127.0.0.1
- 1.1.1.1
cap_add:
- NET_ADMIN
restart: unless-stopped
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment