When I start new containers, Docker automatically assigns some MAC address to them. I am curious if there is a pattern to this assignment. Can the MAC address be changed?
<Docker start assigning always the same mac 02:42:ac:11:00:02
for the first container and then is increasing by one each mac for each different container.
Not sure why they are using that mac address. It seems 02:42:ac
doesn't match any real vendor in oui databases. Look at the official documentation about this. They say:
The MAC address is generated using the IP address allocated to the container to avoid ARP collisions, using a range from 02:42:ac:11:00:00 to 02:42:ac:11:ff:ff
Anyway, you can set any mac address on container generation using --mac-address
parameter on the docker run command. For example doing a command like this docker run -ti --mac-address 00:00:00:00:00:11 ubuntu:trusty
Hope it helps.