Skip to content

[BUG] mac_address is not assigned with external networks #11041

Closed

Description

Description

I'm checking the assignment of mac addresses in external networks on docker-compose version 2.22.0.
I'm testing on the following docker-compose file

version: '3.7'

services:
  busybox:
    image: busybox:latest
    mac_address: "ce:9f:32:e5:92:f4"
    command: sleep 600
    networks:
      - test

networks:
  test:
    external: true
    name: "test"

After up container, i check mac address into container and got different address

% docker-compose version
Docker Compose version v2.22.0
% docker exec $(docker ps -aq --filter "name=busybox") ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
23: eth0@if24: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue 
    link/ether 02:42:ac:13:00:02 brd ff:ff:ff:ff:ff:ff
    inet 172.19.0.2/16 brd 172.19.255.255 scope global eth0
       valid_lft forever preferred_lft forever

If run container it on a docker-compose 2.18.1, then the address is correct

% docker-compose version
Docker Compose version v2.18.1
% docker exec $(docker ps -aq --filter "name=busybox") ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
25: eth0@if26: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue 
    link/ether ce:9f:32:e5:92:f4 brd ff:ff:ff:ff:ff:ff
    inet 172.19.0.2/16 brd 172.19.255.255 scope global eth0
       valid_lft forever preferred_lft forever

Steps To Reproduce

  1. Create docker-compose.yml file
version: '3.7'

services:
  busybox:
    image: busybox:latest
    mac_address: "ce:9f:32:e5:92:f4"
    command: sleep 600
    networks:
      - test

networks:
  test:
    external: true
    name: "test"
  1. Create network
docker network create test
  1. Run docker-compose up on version v2.22.0
docker-compose up -d
  1. check mac address into container
docker exec $(docker ps -aq --filter "name=busybox") ip a
  1. mac address will be ce:9f:32:e5:92:f4

Compose Version

% docker compose version
Docker Compose version v2.22.0
% docker-compose version
Docker Compose version v2.22.0


### Docker Environment

```Text
% docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  compose: Docker Compose (Docker Inc., v2.22.0)

Server:
 Containers: 2
  Running: 0
  Paused: 0
  Stopped: 2
 Images: 634
 Server Version: 20.10.21
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: false
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: a05d175400b1145e5e6a735a6710579d181e7fb0.m
 runc version: 
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 6.0.12-arch1-1
 Operating System: Arch Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 31GiB
 Name: mad-arch
 ID: Q3FJ:BR5P:FNEQ:ARCZ:DFIB:C4GS:RTQC:J4IO:G7TR:I67L:LFFU:VWEA
 Docker Root Dir: /home/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: true
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false


### Anything else?

_No response_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions