Docker build could not resolve ‘archive.ubuntu.com’ when using custom bridge

If you change your docker bridge IP range, Docker’s network configuration description says deleting your bridge and creating a new one will take care of resetting the IP addresses.

Unfortunately docker won’t update the outgoing network traffic masquerade setting if it sees an existing entry in the iptables nat table.

You can verify this by using the ‘iptables -L -t nat -n’ command which will show the default IP range still configured.

You will have to manually flush the PREROUTING table contents using the ‘iptables -t nat -F POSTROUTING’ command. After running this, restart docker and it will initialize the nat table with the new IP range.

Leave a Comment