Manually apply MAC address when supplied (fixes #1)

If specified (via `--mac-address`), Docker only applies a user-selected
MAC address when moving the interface into the container's network
namespace. This means that the initial run of `udhcpc` will use the
random veth MAC address, breaking any statically configured leases
(since this is the IP address that Docker will assign to the container).
pull/8/head
Jack O'Sullivan 5 years ago
parent 7933149acf
commit 4072ce8de4

@ -161,7 +161,11 @@ def create_endpoint():
}
try:
if 'MacAddress' not in req_iface or not req_iface['MacAddress']:
if 'MacAddress' in req_iface and req_iface['MacAddress']:
(if_container
.set('address', req_iface['MacAddress'])
.commit())
else:
res_iface['MacAddress'] = if_container['address']
def try_addr(type_):

Loading…
Cancel
Save