portainer: mac_address is being ignored in docker-compose files
Before you start please confirm the following.
- Yes, I’ve searched similar issues on GitHub.
- Yes, I’ve checked whether this issue is covered in the Portainer documentation or knowledge base.
Problem Description
This is the docker-compose used for setting the mac_address line. This used to work fine until recently. If I run this outside of Portainer with docker-compose up
it generates the MAC address fine.
I am not using a swarm, which another user was having an issue with the same problem: https://github.com/portainer/portainer/issues/9152
Does this have to do with the issue? https://github.com/moby/moby/pull/46406
# Wyoming-OpenWakeWord Container for Docker
version: "3.9"
services:
wyomingopenwakeword:
container_name: "wyoming-openwakeword"
image: "rhasspy/wyoming-openwakeword:latest"
labels:
- "com.centurylinklabs.watchtower.enable=true"
- "com.centurylinklabs.watchtower.monitor-only=false"
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/lib/libvirt/images/usb001/docker-storage/wyoming-openwakeword/data:/data
mac_address: "9e:de:ad:be:ef:01"
hostname: "wyomingopenwakeword"
networks:
- dhcp
ports:
- 10400:10400
devices:
- /dev/snd:/dev/snd
command: --model 'ok_nabu' --model 'hey_jarvis' --model 'hey_rhasspy' --model 'hey_mycroft' --model 'alexa' --preload-model 'ok_nabu'
# --uri 'tcp://0.0.0.0:10400'
restart: "no"
#restart: unless-stopped
#privileged: true
#network_mode: host
networks:
dhcp:
name: "dbrv100"
external: true
Network | IP Address | Gateway | MAC Address | Actions |
---|---|---|---|---|
dbrv100 | 10.0.10.100 | 10.0.10.1 | 16:a7:42:02:66:94 | Leave network |
Random generated MAC ================^
I use static set IP addresses by MAC dished out from DNSMasq DHCP so this breaks all the services for me as they just get random IP addresses instead of their statically defined ones.
Expected Behavior
Generate the mac_address specified.
Actual Behavior
Generates random MAC address.
Steps to Reproduce
Add a new stack, name your stack, dump the yaml above in the web editor, deploy the stack.
Portainer logs or screenshots
Client: Version: 24.0.5 API version: 1.43 Go version: go1.20.6 Git commit: ced0996600 Built: Wed Jul 26 21:44:58 2023 OS/Arch: linux/amd64 Context: default
Server: Engine: Version: 24.0.5 API version: 1.43 (minimum version 1.12) Go version: go1.20.6 Git commit: a61e2b4c9c Built: Wed Jul 26 21:44:58 2023 OS/Arch: linux/amd64 Experimental: false containerd: Version: v1.7.6 GitCommit: 091922f03c2762540fd057fba91260237ff86acb.m runc: Version: 1.1.9 GitCommit: docker-init: Version: 0.19.0 GitCommit: de40ad0
Portainer version
2.19.1
Portainer Edition
Community Edition (CE)
Platform and Version
Docker 24.0.5 | docker-compose 2.20.3
OS and Architecture
Arch Linux 6.5.5-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 23 Sep 2023 22:55:13 +0000 x86_64 GNU/Linux
Browser
Chrome Version 117.0.5938.92 (Official Build) (64-bit)
What command did you use to deploy Portainer?
Pushed the "Deploy the stack" button on the WebUI.
Additional Information
I noticed the version of compose the containers say they used seem to be perpetually set to when they were first deployed:
com.docker.compose.version | 2.20.2
Maybe this is just a database entry as when you hit redeploy it doesn’t update that field. As I have 2.20.3 of compose installed or does Portainer have it’s own docker-compose resource i.e. not /usr/bin/docker-compose etc?
I believe docker-compose had an issue https://github.com/moby/moby/pull/46406 with setting mac_address in this version. It said it was fixed 3 weeks ago maybe that is something? Does docker-compose need to be updated in Portainer to take advantage of this fix or it should use the system /usr/bin/docker-compose etc?
Thank you.
About this issue
- Original URL
- State: open
- Created 9 months ago
- Reactions: 3
- Comments: 35
I tested this and it’s an issue with an older version of Docker Compose, an updated version will be included in the 2.20 release which will resolve this issue.
I had this issue in a different context. I found the following and it led to the solution of my problem.
See here.
So I switched from
to
Now, the mac address is correctly set in my container.
No offical date I can provide, but the team is very close 😃
Great, thanks for testing that and providing feedback that it’s now working. Please remember 2.20 is not currently released and the version I provided is just for testing 😃
Figured out the syntax I had was just wrong should have been like this for version 25:
Looks like it is working now yay!
Hey, so you can try our dev image of 2.20 please keep in mind this it not live and is not suitable for production and should only be used for testing, please let me know how this goes for you.
Business Edition https://hub.docker.com/r/portainerci/portainer-ee/tags
portainerci/portainer-ee:2.20
Community Edition https://hub.docker.com/r/portainerci/portainer/tagsdocker pull portainerci/portainer:2.20
I can’t give dates but we are now in code freeze, so it’s close 😃
I’m eager to see the fix and try again in-place. Thank you for helping me escalate this issue.
Thanks for raising this, I am going to follow this up internally and test this. I will give updates here
Still happening:
I am also seeing the same issue. I ended up rolling back to 2.17.1 to restore functionality. Seems it was introduced with 2.18.0
Rather run latest patches/versions. Please advice on an eta for the fix.
Sample compose doc. Seeing the issue across all of them:
`