How to control LXD host from inside a container?

by Alexandre Lara   Last Updated November 15, 2017 07:00 AM

I'm new to LXD and I'm planning to use it to host multiple websites using Nginx and HaProxy.

The problem that I'm facing is that I'd like to have a dashboard that allow me to control each container, so I can delete/create new containers but I don't know where should I put this dashboard so I would have access to the LXD host. For example, let's say that I have these containers:

site1 (a website)
site2 (a website)
panel (the panel that I want to create)
haproxy (load balancer)

The problem that I see with this approach is that since the panel is inside a container, it won't have access to the LXD host, so it won't be able to use commands to create/delete an instance.

One possible way to solve that would be by using SSH to connect to the host, but I'm not sure if it's safe or if it would be a good solution.

Another possible solution is to create a 'master' container where I would install the panel and add all other containers in it, using a nested LXD architecture. But I'm not sure if I would lose much performance and if it would be possible to use Nginx + HaProxy to have multiple websites running, because since it's nested containers, I don't know how I would configure in a way to make it works.

How can I control a LXD host from inside a container? Which approach would be better? Do you have any other solution?

Tags : lxc lxd


Related Questions