[Lxc-users] Container size minialisation
Gordon Henderson
gordon at drogon.net
Mon Dec 12 18:27:18 UTC 2011
On Mon, 12 Dec 2011, István Király - LaKing wrote:
> Hi folks.
>
> I'm trying to compose a system, where lxc containers behave like virtual
> hosts for a web server.
>
> As next step I would like to minimize container size. My question is,
> what the best, most elegant and fail proof technique for that?
>
> At this moment I'm thinking of a "master container" and "slave
> containers" where the /usr folder for example in the slave containers is
> a mount from the master container. That gives a significant size drop
> already, from 400 to 40 megabytes.
>
> I would like to keep the containers really minimal. 4 megabyte should be
> small enough.
>
> Lets say only some important files in /etc ....
>
> Has anyone any experience with this technique? Thank you for sharing.
I use something similar for my hosted PBXs (asterisk).
Each PBX container mounts a commonn set of directories from teh host for
the asterisk installation - e.g. the asterisk binaries, libraries, modules
and sounds. also a common set for apache. This is all in the fstab
referenced from each containers config file, so they're all bind-mounted
at container start time. (read only too)
One thing to beware of - you can't share everything like this - e.g. /usr
- which I initially thought I could - well, maybe I could, but doing
things like apt-get update in one container would potentially update files
in /usr in all containers which might not be the best thing. You could
probably do it with care though - I simply can't be bothered.
I have to say: I'm not really that bothered about disk space - it's not a
big deal. I do it that way as it makes it easier to update asterisk over
all the containers. My "LAMP" type containers don't do any of this.
Gordon
More information about the lxc-users
mailing list