mirror of
https://github.com/apple/container.git
synced 2026-08-28 19:36:31 +00:00
+3
-6
@@ -244,14 +244,11 @@ The MAC address must be in the format `XX:XX:XX:XX:XX:XX` (with colons or hyphen
|
||||
container run --network default,mac=02:42:ac:11:00:02 ubuntu:latest
|
||||
```
|
||||
|
||||
To verify the MAC address is set correctly, run `ip addr show` inside the container:
|
||||
To verify the MAC address is set correctly, read the interface MAC directly from sysfs inside the container:
|
||||
|
||||
```console
|
||||
% container run --rm --network default,mac=02:42:ac:11:00:02 ubuntu:latest ip addr show eth0
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
|
||||
link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff
|
||||
inet 192.168.64.2/24 brd 192.168.64.255 scope global eth0
|
||||
valid_lft forever preferred_lft forever
|
||||
% container run --rm --network default,mac=02:42:ac:11:00:02 ubuntu:latest cat /sys/class/net/eth0/address
|
||||
02:42:ac:11:00:02
|
||||
```
|
||||
|
||||
If you don't specify a MAC address, `container` will generate one for you. The generated address has a first nibble set to hexadecimal `f` (`fX:XX:XX:XX:XX:XX`) in case you want to minimize the very small chance of conflict between your MAC address and generated addresses.
|
||||
|
||||
Reference in New Issue
Block a user