Serge Hallyn: Docker in LXD https://s3hh.wordpress.com/2016/04/09/docker-in-lxd/
http://s3hh.wordpress.com/?p=506
Since the very early days of upstream Linux containers around 2006 weve been distinguishing between application and system containers. (The definition of application containers has changed a bit, and their use case has changed a *lot*, but the general gist remains the same).
A few years ago I would get regular daily! queries by lots of people asking what I thought of Docker. Some asked because, as one of the early people involved in kernel container functionality, Id be interested. Others did so because I had been working with http://linuxcontainers.org/lxc, a particular container administration suite, and thought Id feel competitive. However, as weve said for a long time, Docker is a great tool for application containers and application container purposes. From a LXC/LXD perspective, were looking at different use cases. One of those is hosting containers in which to run Docker
And, in Ubuntu 16.04, you can easily do so. (The Docker patches to enable this are on their way upstream.) To run Docker inside a container, the container must have a few properties. These are conferred by the docker profile. The docker profile does not include a network interface, so youll want to create a container with both the default and docker profiles:
lxc launch ubuntu-daily:xenial docker1 -p default -p docker
Now, enter the container and install the docker.io package:
lxc exec docker1 apt update
lxc exec docker1 apt install docker.io
lxc exec docker1 docker pull ubuntu
lxc exec docker1 docker run -it ubuntu bash
et voila, a docker container is running inside your lxd container. By itself this may seem like a novelty. However, when you start deploying the lxd hosts with openstack nova-lxd plugin or juju-lxd, the possibilities are endless.