-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Random MAC ADDRESS on MACVLAN adapter #5861
Comments
Hi @Thormir84 - yes, that's expected in 28.0.0 (release notes). You can configure a MAC addresses when creating a container with the |
This broke some aspects of home assistant for me. My Shelley devices and emulated hue / alexa pairing stopped working. I assume this has do with a mis-matched mac address after recreating my homeassistant container with docker v28. I fixed this by restoring a snapshot, noting the mac address of the homeassistant container (
|
@robmry A macvlan device to be changing The So far my team has run into List of breaking changes so far:
|
Hi @gaby - thanks for letting me know. We try to minimise the impact of any changes but sometimes, in a major release, they are unavoidable.
In previous releases, a container's MAC address was based on its IPv4 address. From 28.x, a container may no longer have an IPv4 address (or, in the case of macvlan, any IP address at all). And, a MAC address can't be derived from an IPv6 address in the same way because the MAC address doesn't have enough bits. The mapping between addresses was also a blocker for adding IPv6 support to Swarm. So, we had to break the relationship between IPv4 address and MAC address. In all releases, when a container is stopped it loses its IP address reservation - another container can be started with the same IP address while it's stopped. If the IPv4 address is explicitly configured, but gets reused while the container is stopped, the container won't start because of the clash. If the IPv4 address is not explicitly configured, the container will start with a new IP address and, in 27.x and earlier, with a new MAC address matching that IP address. (Neither IP or MAC address are reserved while a container is stopped, and both may be automatically assigned new values on a container restart or when a container is re-created, unless they're explicitly configured.) So, breaking the link between IPv4 and MAC addresses means when a container with no configured MAC address is restarted in 28.x, the address assigned when it restarts is randomly generated - so, it will change, even when the IP address is configured. It may be possible to preserve a container's generated MAC address while it's stopped, so it doesn't change on a So, as with IP addresses - if a specific MAC address is significant to other services in the network, the way to make sure it doesn't change is to configure it.
I think that was the case in 27.x too. The moby API uses a map of network endpoints (rather than an ordered list). Do you have an example of the changed behaviour? Is the issue that the container's interface names (
Can you share details or an example? ... The In 28.x, the new |
Description
After installing the latest update (5.28.0.0-1 - debian.12), every time I restart or update a container with a MACVLAN adapter associated with it, its MAC ADDRESS changes randomly; the "problem" is that I have LAN monitoring utilities that, every time, notify me of the access of a new device.
Reproduce
Install the latest version of docker.
Reboot or upgrade an existing container, which is associated with a MACVLAN adapter.
Expected behavior
The MAC ADDRESS of the container must always remain the same.
docker version
Client: Docker Engine - Community Version: 28.0.0 API version: 1.48 Go version: go1.23.6 Git commit: f9ced58 Built: Wed Feb 19 22:10:43 2025 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 28.0.0 API version: 1.48 (minimum version 1.24) Go version: go1.23.6 Git commit: af898ab Built: Wed Feb 19 22:10:43 2025 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.7.25 GitCommit: bcc810d6b9066471b0b6fa75f557a15a1cbf31bb runc: Version: 1.2.4 GitCommit: v1.2.4-0-g6c52b3f docker-init: Version: 0.19.0 GitCommit: de40ad0
docker info
Additional Info
No response
The text was updated successfully, but these errors were encountered: