Skip to content

Instantly share code, notes, and snippets.

@maxivak
Last active June 8, 2020 15:38
Show Gist options
  • Save maxivak/86a4358c8687cbf0af47563470b64ee6 to your computer and use it in GitHub Desktop.
Save maxivak/86a4358c8687cbf0af47563470b64ee6 to your computer and use it in GitHub Desktop.
LXC containers in Ubuntu 16.04

Install LXC

Config LXC

~/.config/lxc/default.conf

lxc.network.type = veth
lxc.network.link = lxcbr0

lxc.id_map = u 0 100000 65536
lxc.id_map = g 0 100000 65536

Network

If it is desirable for the container to be publicly accessible, there are a few ways to do it:

  • use iptables to forward host ports to the container
  • bridge the host's network interfaces
  • ask LXC to use macvlan for the container's NIC. Note that this has limitations and depending on configuration may not allow the container to talk to the host itself. Therefore the other two options are preferred and more commonly used.

Read more - https://wiki.debian.org/LXC/SimpleBridge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment