Docker swarm in lxc - second and subsequent lxc containers always fail to install

Hi all
I am trying to emulate a multi manager and multi worker docker swarm dev environment so I followed the informative tutorial by Stephane Graber to create 6 LXC containers, each with Docker installed inside.
In the first LXC container, I manage to always install Docker successfully. However, whenever I try to install Docker on the next LXC container, the installation fails. I have tried it several times, with the same result.
The LXC containers are clones, so they are identical, except for the ip address, hostname, etc.
Is there something I should do to install Docker on multiple LXC containers? Or am I doing something wrong?
Thank you for your help


Stephane did not demo a Swarm which is more complex. At the moment the closest we’ve got to it is this comment but that didn’t work for me:

I’ve stuck to VMs for now which is sad. Same for Gluster. Some things are just too complex for a restricted container environment at the moment. The way I see it for Docker Swarm, is In the end we’re still a little better off on LXD than the previous hypervisor, even being at the same level of abstraction.

As for your question, I’ve not run into that sort of issue apart from UID type things in software so I tend to manage fresh deployments through cloud-init which you can do in the instance config, and then Ansible for heavy lifting and the rest of the instance’s lifecycle. I suspect you would get most of the Docker installation done via cloud-init but to fully automate you probably would need Ansible to get the relevant Swarm join tokens as artefacts and then initialise the rest Swarm nodes with the appropriate join tokens. In your Ansible inventory you can stipulate which are the Worker and Manager nodes and which ones to set to drain if you want a lightweight Manager only node.

You will be more fruitful if you dig through some logs and post some relevant extracts here for folks to be able to help with the errors.