I have a working LXD container for Discourse on one LXD host that works fine. I export a copy of that container and import it on another host. The container has nested docker inside it as a part of the application. On the new system, docker inside the LXD fails to start properly.
The specific issue is that my application seems to require the overlay2 storage driver for docker. The original container has this driver. The new container will not start docker with overlay2.
scott@Discourse-1:~$ docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running
I am confused since the export of the original container runs fine. When I import it, docker is broken.
Any ideas?
Ok, so I determined the solution. My LXD default storage pool is ZFS. My nested docker application had a requirement for an overlay2 file system. Apparently Overlay2 cannot be nested inside of a ZFS storage pool.
My solution was to create a new “dir” based pool and move the imported container from the zfs pool to the new pool.
If you are interested in using existing ZFS pools because dir storage type isn’t optimal, you could also attach a second disk as type block created via sudo zfs create... at a generic mount-point within the container, which is formatted with EXT4 or others that are supported by Docker. You then bind mount directories on that second disk to the default locations for docker so they sit on the attached disk.
The Docker Swarm feature is problematic in a container based on what I’ve read and the issues that others and myself are experiencing. Sad and I think for now that Docker Swarm needs to live in VMs.
E.g. zfs create, note not using LXD’s structure: