When you are inside a LXC container you can experience errors (more like a freeze) when you try to access the virtual network (veth) using crypto resources like wget, ssh and other (so, maven will fail, git will fail and other apps that uses TLS and SSL). This is a mtu issue. You must to set the MTU of the eth0 (veth inside the container) with the same value of the bridge MTU.
So, outside of the container do:
$ ifconfig lxcbr0 lxcbr0: flags=4419<UP,BROADCAST,RUNNING,PROMISC,MULTICAST> mtu 1400 ...
So, we can see that the value for the bridge mtu is 1400.
Now, inside the container we have:
# lxc-attach -n container-name -- ifconfig eth0 eth0 Link encap:Ethernet HWaddr 42:05:9d:51:4c:d6 inet addr:192.168.30.83 Bcast:192.168.30.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 ...
You can change the value in runtime to match the bridge (in this case 1400) using:
# lxc-attach -n container-name -- ifconfig eth0 mtu 1400 # lxc-attach -n container-name -- ifconfig eth0 eth0 Link encap:Ethernet HWaddr 42:05:9d:51:4c:d6 inet addr:192.168.30.83 Bcast:192.168.30.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1400 Metric:1 ...
This also can be defined in the config file for a container (example: /var/lib/lxc/container-name/config), you just have to add:
lxc.network.mtu=1400
You can define as default for new containers adding this to the file /etc/lxc/default.conf