Recommendations: functionality per container

Hi, I hope everyone is well at this time. Also, apologies for the cryptic subject - I hope my description is better.

For sometime I have been running some VMs on my home server but would like to move the functionality they provide to LXD since it is much more lightweight.

One such VM provides a number of services; Webserver (via Apache), DNS & DHCP servers (via dnsmasq), Samba server, Zabbix network monitoring and some random utilility deamons (i.e monitor my rooftop Solar array).

As I migrate this functionality to LXD it made me consider, how much of this functionality should I put per container; one ‘function’ per container for example? Is there any recommendation I should follow? What do others do?

Many thanks for any suggestions,

I tend to go with one service per container where a service can still be multiple processes depending on what it relies on.

This allows running distribution release upgrades on a per service basis and limiting what goes down if the upgrade fails.

Thanks @stgraber, that makes sense.

If I was going down the path of many ‘skinny’ containers then, is it worth thinking about the base image to start from? I prefer and know Ubuntu, so normally go that route but is there much benefit to seeking out a more lightweight image? (I do note the Ubuntu image already seems very skinny).

A container image can affect you in terms of memory and in terms of disk space.

You can compare the disk space between container images rather easily, but still thanks to copy-on-write (COW), it should not be too big of an issue. The Ubuntu container images by default perform the security updates automatically through the unattended-upgrades package. Therefore, any significant inadvertent size increase per container would be by those package upgrades.

Memory can be a problem, and again a container has only the basic services running. You can measure the memory and also count the number of process between different types of containers.

If you want to use lightweight Ubuntu images, you can try the Minimal container images at
The page has instructions on how to add the appropriate remote to your LXD installation, and also how to launch such a container.

1 Like