Docker Community Forums

Share and learn in the Docker community.

Setting DNS with Macvlan

Hey,

i want to set a specific DNS server. Is this the correct code to achieve this?
The rest works as it should.

version: ‘2’

services:
homebridge1:
container_name: homebridge
image: oznu/homebridge:latest
hostname: homebridge
mac_address: d0:ca:ab:cd:ef:09
networks:
macvlan0:
ipv4_address: 192.168.178.250
dns:
- 192.168.178.1
environment:
HOMEBRIDGE_CONFIG_UI: 1
HOMEBRIDGE_CONFIG_UI_PORT: 80
TZ: Europe/Berlin
PGID: 100
PUID: 1026
volumes:
- /volume1/docker/homebridge:/homebridge
restart: always

homebridge2:
container_name: homebridge_testing
image: oznu/homebridge:latest
hostname: homebridge1
mac_address: d0:ca:ab:cd:ef:08
networks:
macvlan0:
ipv4_address: 192.168.178.249
dns:
- 192.168.178.1
environment:
HOMEBRIDGE_CONFIG_UI: 1
HOMEBRIDGE_CONFIG_UI_PORT: 80
TZ: Europe/Berlin
PGID: 100
PUID: 1026
volumes:
- /volume1/docker/homebridge_testing:/homebridge_testing
restart: always

networks:
macvlan0:
driver: macvlan
driver_opts:
parent: ovs_eth0
ipam:
config:
- subnet: 192.168.178.0/24
gateway: 192.168.178.1
ip_range: 192.168.178.240/28