My host IP is 192.168.88.3. I have created a macvlan network named “macvlan_network”. My docker version is:
Client: Docker Engine - Community
API version: 1.41
Go version: go1.13.15
Git commit: 55c4c88
Built: Tue Mar 2 20:18:46 2021
Macvlan works as expected and I was successful in assigning specific IP to each container. Though I was able to deploy containers using the run command but having some issues using docker-compose.yml. For example, I like to run my pihole container in 192.168.88.5 on macvlan_network. So, for that instance run command works perfectly fine.
`docker run --name=pihole --net=macvlan_network --ip=192.168.88.5 -e ServerIP=192.168.88.5 -e WEBPASSWORD=pass -e TZ=timezone -e TEMPERATUREUNIT=c -v /etc-pihole/:/etc/pihole/ -v /etc-dnsmasq.d/:/etc/dnsmasq.d/ --cap-add=NET_ADMIN --restart=unless-stopped pihole/pihole`
But, I am having errors when I use docker compose.
version: "3" # More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/ services: pihole: container_name: pihole image: pihole/pihole:latest ports: - "53:53/tcp" - "53:53/udp" - "67:67/udp" - "80:80/tcp" - "443:443/tcp" environment: ServerIP: '192.168.88.5' TZ: 'timezone' WEBPASSWORD: 'pass' PIHOLE_DNS_: '127.0.0.1' TEMPERATUREUNIT: 'C' # Volumes store your data between container upgrades volumes: - './etc-pihole/:/etc/pihole/' - './etc-dnsmasq.d/:/etc/dnsmasq.d/' # Recommended but not required (DHCP needs NET_ADMIN) # https://github.com/pi-hole/docker-pi-hole#note-on-capabilities cap_add: - NET_ADMIN networks: macvlan_network: driver: macvlan driver_opts: parent: eth0 ipam: config: - subnet: 192.168.88.0/24 gateway: 192.168.88.1 restart: unless-stopped
How, can I add the pihole container on my macvlan_network with the specific IP. Any response will be appreciated.