I'm running docker on pi 3b and have several macvlan networks. I'm trying to run the PiHole docker image connecting to the existing macvlan network.
Host ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:de:5c:ff:65 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.28.9 netmask 255.255.255.0 broadcast 192.168.28.255
inet6 fe80::3232:402d:aaf8:539d prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:a3:9b:78 txqueuelen 1000 (Ethernet)
RX packets 75102 bytes 14119174 (13.4 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 15305 bytes 3318336 (3.1 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0.66: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.66.9 netmask 255.255.255.0 broadcast 192.168.66.255
inet6 fe80::771d:94bf:49bb:bf4 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:a3:9b:78 txqueuelen 1000 (Ethernet)
RX packets 9454 bytes 1326022 (1.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 9159 bytes 1659722 (1.5 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0.76: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.76.9 netmask 255.255.255.0 broadcast 192.168.76.255
inet6 fe80::22b5:e86b:5a13:5f8f prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:a3:9b:78 txqueuelen 1000 (Ethernet)
RX packets 219 bytes 17586 (17.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 36 bytes 3508 (3.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 10 bytes 838 (838.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 10 bytes 838 (838.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
docker network ls
NETWORK ID NAME DRIVER SCOPE
9d9a2e8c019c bridge bridge local
dda7db02a0c4 host host local
e609ec5dd85c macvlan-28 macvlan local
d069d49a88d1 macvlan-66 macvlan local
99fc39f0335b macvlan-77 macvlan local
9c251aacc00d none null local
docker network inspect macvlan-66
[
{
"Name": "macvlan-66",
"Id": "d069d49a88d1b5fd0804e57c96291b90ad0ff2d887eaea8adf751388239f919c",
"Created": "2021-03-22T16:08:04.66937887Z",
"Scope": "local",
"Driver": "macvlan",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": {},
"Config": [
{
"Subnet": "192.168.66.0/24",
"IPRange": "192.168.66.192/27",
"Gateway": "192.168.66.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"148274f6cc52bb70011949879900f01be135d86dc63efc94e8f924d34fbd26c2": {
"Name": "pihole",
"EndpointID": "95c0e45f5f11625df47a63d921f96ea8eb9c75471b8f89d3dfcaa5bb7d8786fb",
"MacAddress": "02:42:c0:a8:42:c0",
"IPv4Address": "192.168.66.192/24",
"IPv6Address": ""
}
},
"Options": {
"parent": "eth0.66"
},
"Labels": {}
}
]
PiHole docker-compose.yaml
version: '3'
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
hostname: pihole
# domainname:
cap_add:
- NET_ADMIN
networks:
macvlan-66:
ipv4_address: 192.168.66.192
volumes:
- './etc-pihole/:/etc/pihole/'
- './etc-dnsmasq.d/:/etc/dnsmasq.d/'
# dns:
# - 127.0.0.1
# - 185.37.37.37
# - 185.37.39.39
# - 8.8.8.8
# - 8.8.4.4
# ports:
# - "443/tcp"
# - "53/tcp"
# - "53/udp"
# - "67/udp"
# - "80/tcp"
environment:
net: host
TZ: 'Europe/London'
ServerIP: 192.168.66.192 # <-- Update (match ipv4_address)
# VIRTUAL_HOST: # <-- Update (match hostname + domainname)
# WEBPASSWORD: "password" # <-- Add password (if required)
restart: unless-stopped
# commented out as is already defined as external network below
# networks:
# macvlan-28:
# driver: macvlan
# driver_opts:
# parent: ovs_eth0
# ipam:
# config:
# - subnet: 192.168.123.0/24 # <-- Update
# gateway: 192.168.123.1 # <-- Update
# ip_range: 192.168.123.192/28 # <-- Update
networks:
macvlan-66:
external: true
Running docker-compose runs fine, but when I visit the IP with a browser it won't load. I can ping the IP successfully.
If I run a test httpd file, it runs fine and is accessible via a browser on the IP address.
httpd docker-compose.yaml
version: '3'
services:
httpd:
image: httpd:latest
container_name: httpd
networks:
- macvlan-66
networks:
macvlan-66:
external: true
There is obviously something wrong with my PiHole compose file but I can't figure out what!
The docker-compose.yaml is cribbed from https://hub.docker.com/r/pihole/pihole and http://tonylawrence.com/posts/unix/synology/free-your-synology-ports/ as linked in the PiHole documentation.