Giving container its own ip address with docker-compose?

You will have to provide more info to try and figure out what's going on. For example what command did you enter to create your macvlan network? This is mine:

sudo docker network create --driver=macvlan --gateway= --subnet= --ip-range= -o parent=eth1 --aux-address="host=" macvlan0

This creates a network named macvlan0 that covers ip range through and I then modified the dhcp settings of my router to only assign ip addresses from and above.

The -aux-address is the ip address that is assigned to the pihole container (see ServerIP in docker-compose). Below is my docker-compose:

version: "3"

services: pihole: capadd: - NET_ADMIN container_name: pihole-vlan dns: - - domainname: environment: DHCP_ACTIVE: "true" DHCP_END: DHCP_IPv6: "false" DHCP_LEASETIME: 168 DHCP_ROUTER: DHCP_START: DNSMASQ_LISTENING: local DNSMASQ_USER: root IPv6: "false" PIHOLE_DNS: PIHOLE_DOMAIN: insert your router domain ServerIP: TZ: ${TZ} VIRTUAL_HOST: pihole. WEBPASSWORD: insert your pihole password hostname: image: pihole/pihole:latest mac_address: de:ad:be:ef:ff:01 networks: macvlan: ipv4_address: ports: - 443/tcp - 53/tcp - 53/udp - 67/udp - 80/tcp - 20/tcp restart: unless-stopped volumes: - /volume1/docker/pihole/volume:/etc/pihole - /volume1/docker/pihole/config/dnsmasq.d:/etc/dnsmasq.d - /volume1/docker/pihole/logs:/var/log networks: macvlan: external: true

/r/docker Thread Parent