I’m new to docker-compose and trying to create the following.
My network at home is a 192.168.1.0/24 network. I have a raspberry pi with docker on it installed with IP 192.168.1.50
I want to create 2 containers as with PiHole and Unbound. I want to reach Pihole via 192.168.1.200 address. And I have created also a bridge for the communication between PiHole and Adguard. When I start the docker compose file I get an error :
reating network "dockerfiles_mvltest" with driver "macvlan"
Creating network "dockerfiles_brdtest" with driver "bridge"
Creating pihole ... error
Creating unbound ...
Creating unbound ... done
ERROR: for pihole Cannot start service pihole: Address already in use
ERROR: Encountered errors while bringing up the project.
This is how the docker-compose.yaml file looks like :
version: '3'
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
# cap_add: # Uncomment if you want to use Pi-Hole for DHCP
# - NET_ADMIN
ports:
- 53/tcp
- 53/udp
# - 67/udp # Uncomment if you want to use Pi-Hole for DHCP
- 80/tcp
environment:
- FTLCONF_LOCAL_IPV4=192.168.1.200
- WEBPASSWORD=Welkom123
- PIHOLE_DNS_=10.1.0.2
- TZ=Europe/Amsterdam
- DNSMASQ_USER=root
- DNSMASQ_LISTENING=local
volumes:
- ./pihole/data:/etc/pihole:rw
- ./pihole/dnsmasq.d:/etc/dnsmasq.d/:rw
networks:
mvltest:
ipv4_address: 192.168.1.200
brdtest:
ipv4_address: 10.1.0.1
restart: always
unbound:
container_name: unbound
image: mvance/unbound:latest
ports:
- 53/tcp
- 53/udp
networks:
brdtest:
ipv4_address: 10.1.0.2
restart: always
networks:
mvltest:
driver: macvlan
driver_opts:
parent: ens33
ipam:
config:
- subnet: 192.168.1.0/24
gateway: 192.168.1.254
brdtest:
driver: bridge
ipam:
config:
- subnet: 10.1.0.0/30
What am I doing wrong?
I was hoping that this construction is going to work. I found this example on youtube.