portainer: mac_address in docker compose seems to be ignored
Use Case (delete as appropriate): Using Portainer at Home
Version: Community Edition 2.18.3
Have you reviewed our technical documentation and knowledge base? Yes
Question: I am trying to get a stack from docker compose file running two pi hole instances, using a macvlan network I’ve set up. I was able to manually create containers, and assign them mac addresses, so that each container gets a different IP.
So, I deploy the following docker compose stack:
version: "3.1"
services:
pihole1:
mac_address: 10:50:02:01:00:01
image: pihole/pihole:latest
environment:
TZ: 'Europe/London'
volumes:
- etc-pihole:/etc/pihole
- etc-dnsmasq:/etc/dnsmasq.d
restart: unless-stopped
networks:
dns_services:
pihole2:
mac_address: 10:50:02:01:00:02
image: pihole/pihole:latest
environment:
TZ: 'Europe/London'
volumes:
- etc-pihole:/etc/pihole
- etc-dnsmasq:/etc/dnsmasq.d
restart: unless-stopped
networks:
dns_services:
networks:
dns_services:
external:
name: dns_services
volumes:
etc-pihole:
external:
name: etc-pihole
etc-dnsmasq:
external:
name: etc-dnsmasq
This successfully creates two services as expected, but the mac_address
seems to be completely ignored. If I look at the running containers, they BOTH have IP of 10.50.2.2
with a MAC address of 02:42:0a:32:02:02
. How can I get Portainer to understand that each container should have a distinct MAC address (otherwise, they won’t get different IPs).
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 23
Yes that could potentially work. I’ll give this a go tomorrow hopefully if I can get a moment spare. In the mean time, it doesn’t look like this is an issue in Portainer so can probably be closed, thank you both for your excellent help, really appreciate it!
I don’t have a Pi but I’ve tested on
linux aarch64 Ubuntu 22.04.2 LTS
and it worked fine. I’ll get one of my colleagues to test on a Pimacvlan
is an important piece in the puzzle… Will check that too