There are not too many boxes from Vagrant supporting LXC, almost all of the supported boxes I found were last updated 2 years ago.

I want to exploit the good side of linux virtualization. Virtualized environment can be fast to launch and destory. Similar to Docker, LXD uses kernel namespaces to seperate client and host environment. This is ideal for alternative software development environment where I just want to seperate the packages from a environment specific to a certain workflow.

restart LXD

sudo systemctl restart snap.lxd.daemon

map lxd to user uid/guid

In /etc/subuid and /etc/subgid, add

lxd:1000:1
root:1000:1

initiate LXD

sudo lxd init

It has to be run with sudo.

launch container

  • lxc launch ubuntu:16.04 graph
  • lxc config set graph raw.idmap both 1000 1000
  • lxc exec graph -- su ubuntu bash This is important for idmapping to work since the first non root user is ubuntu with uid 1000, which will be mapped to the host uid 1000