How to fix Mac address through Rancher

Hello all,

We tried to deploy a Stack with multiple containers.
Some of this containers run a specific application with a license control that need to identify a specific Mac adresse for working.

With docker run command it’s easy, we just pass the option --mac-address like that :

docker run --mac-address=XX:XX:XX:XX:XX:XX -i -t -h stream04 docker-registry.svcs.dc1.xxxxx.com:5000/stream_centos:0.1 /bin/bash

We tried to reproduce the same thing with docker-compose.yml following Docker’s doc :

Stream-centos:
  ports:
  - 22223:22/tcp
  labels:
    io.rancher.scheduler.affinity:host_label: io.rancher.host.linux_kernel_version=4.2
  tty: true
  image: docker-registry.svcs.dc1.xxxxxxxxxxx.com:5000/stream_centos:0.1
  volumes:
  - /ramfs:/ramfs
  domainname: xxxxxx.xxxx
  hostname: stream03
  mac_address: XX:XX:XX:XX:XX:XX
  stdin_open: true

But it seem rancher will not retain this option when they deploy the stack.

Have we miss something ?

This has been updated in libcompose, but we haven’t made the sync to rancher-compose.

When a new docker-compose ability is created, it originates in docker/compose, which is how docker-compose is run. There is a go interpretation of compose, which is called docker/libcompose that tries to maintain parity to docker-compose. Rancher-compose works off libcompose (we were the majority contributor when it was first launched) and needs to be synced with docker/libcompose to get the same functionality.

Can you make a github enhancement request to make sure we test this in the next sync?

Hi Denise,

Done on number #3905.

Regards

Bastien

I just found out that even though the feature will eventually be brought into rancher-compose, Rancher itself will not be able to support mac addresses.

Apologies for the confusion.

is this still unsupported? and if not how can i add a mac through the gui?

With the new CNI driver rancher should be able to control this now. This would be a major benefit to us

Some searching through the code brought me to this:

I tried it out and it works.

if you set the io.rancher.container.mac_address label on the container it works

2 Likes

Thanks.Perfectly solved my problem!

FYI: It’s not an advertised feature :slight_smile: … Proceed with caution.