After connecting lxd to a custom bridge, installing docker breaks it such that lxc containers can no longer obtain IP addresses.
Repro case:
-
Create an ubuntu server 19.10 VM
-
Execute the following as root in the VM:
cat </etc/netplan/01-br0.yaml
network:
version: 2
renderer: networkd
ethernets:
ens3:
dhcp4: false
dhcp6: false
bridges:
br0:
interfaces: [ens3]
dhcp4: true
parameters:
stp: false
forward-delay: 0
EOF
rm /etc/netplan/50-cloud-init.yaml
netplan apply -
Switch to the normal user and run lxd init. Use storage pool type “dir”. Say no to creating a bridge, and yes to use an existing bridge. Use bridge “br0”. Choose defaults for everything else.
-
Run lxc launch ubuntu:18.04 test
-
Run lxc list to see that container “test” has an ipv4 address:
±-----±--------±----------------------±-----±-----------±----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
±-----±--------±----------------------±-----±-----------±----------+
| test | RUNNING | 192.168.122.46 (eth0) | | PERSISTENT | 0 |
±-----±--------±----------------------±-----±-----------±----------+ -
Run sudo snap install docker
-
Reboot the VM
-
Log in as normal user again and type lxc list to see that the container no longer has an ipv4 address:
±-----±--------±-----±-----±-----------±----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
±-----±--------±-----±-----±-----------±----------+
| test | RUNNING | | | PERSISTENT | 0 |
±-----±--------±-----±-----±-----------±----------+
From this point forward, no lxc containers will ever get an IP address.
If you do all of these steps without installing docker (step 6), it works perfectly.