Docker + Bridges + DHCP

It appears that this is an open issue and is this is specific to Ubuntu containers and apparmor.

A workaround was posted in there from bprodoehl:

  • Start the container as privileged with --privileged
  • Add the following line to the dockerfile: RUN mv /sbin/dhclient /usr/sbin/dhclient
  • Run dhclient eth0 and you will still see the error message: mv: cannot move '/etc/resolv.conf.dhclient-new.29' to '/etc/resolv.conf': Device or resource busy, but you will now have an IP and you can use the network.