Skip to content

Docker Compose Mac Addresses and Scale #4236

@k2xl

Description

@k2xl

Trying to test out some systems with docker.

system:
    mac_address: 11:11:12:34:5a:bc

I need the first few characters of the mac address to always be 1111 (another container searches the network and looks for devices starting with these values).
I'd like to do docker-compose scale system=5, but when I do it, all 5 will have the same mac address. Is there some way to get the mac address dynamic? I don't care if I need to hack my way around it.

One idea I had was to write a bash script that would run something like

export MAC_ADDR=11:11:<random value>
docker-compose scale=2
export MAC_ADDR=11:11:<random value>
docker-compose scale=3
... etc

But wasn't sure if there was some other mechanism?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions