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

Hi.

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.