[lxc-users] How to auto-start LXC containers with LXD

Stéphane Graber stgraber at ubuntu.com
Wed May 6 09:27:56 UTC 2015


On Wed, May 06, 2015 at 11:46:54AM +0300, Ozan Hazer wrote:
> Yeah, I wish I realized that before setting up everything :\
> I agree with the central configuration thing, it reduces the portability
> too at first glance. However not sure if it should be considered as a
> deficiency...
> lxd is designed this way and instead of manually doing things (copying
> etc.) it provides tools for it which attracted me in the first place. I can
> do what lxd does with lxc-* commands already but lxd is much easier to use
> and gives the feeling of vagrant and docker.
> There is lxc copy and move and I bet (or hope?) there will be some export
> or backup command in the future... The configurations are kept in sqlite
> (/var/lib/lxd/lxd.db) so extracting the config should not be that hard
> (hope again :) )

It's really a different design. For LXD we want more input validation,
we want to be able to inherit from profiles and we generally need to
store more complex constructs than can be stored in the LXC config file.

So that and speed (it turns out opening and reading thousands of files
isn't very quick) is what made us use a database.

While it's not in our immediate roadmap, commands to import/export
containers as we do images may be a possibility and may be covering your
needs.

> 
> The problem that hit me is lxd is apparently is not mature enough and the
> announcement that ubuntu made and advertised misleaded me since I'm a
> developer and not following server technologies closely.

Not sure how our announcement is misleading...

For the Ubuntu 15.04 announcement, I wrote:

"""
Ubuntu 15.04 ships with LXD 0.7. This is the result of an intense 6
months of development and while not ready for production workloads, it's
definitely ready for experimentation.
"""

And upstream, outside of bugfix-only releases, we've always included
this in our announcements:

"""
Please note that it's still early in the LXD development and that
current LXD isn't intended for production use and comes with no support
statement from upstream.
(reported bugs and patches will be included in the next release)
"""

> For the auto-startup issue I ended up with writing a systemd job for
> startup and I guess I'll need smt. else for a clean shutdown too... I have
> atlassian products (jira & stash) running inside the container and they are
> not starting for some reason... Still investigating...

Getting the power state stuff done shouldn't be too difficult. I believe
we already have the DB field, so all that's needed is code to attach the
SIGPWR signal with a shutdown function which stops all containers and
mark their states in the power_state field, then another function run at
startup just needs to read the power_state field, start any container
that's set to 1 and then unset the field.

We'd certainly welcome a branch for that.

> 
> 
> 
> > ---------- Forwarded message ----------
> > From: Andrey Repin <anrdaemon at yandex.ru>
> > To: Serge Hallyn <lxc-users at lists.linuxcontainers.org>
> > Cc:
> > Date: Tue, 5 May 2015 19:24:52 +0300
> > Subject: Re: [lxc-users] How to auto-start LXC containers with LXD
> > Greetings, Serge Hallyn!
> > >> How do I configure LXC containers so that it'll start automatically in
> > >> Ubuntu 15.04 and LXD?
> > >> Ubuntu documentation states that the containers with the configuration
> > >> lxc.start.auto=1 will be started on boot however I couldn't find the
> > config
> > >> file for the container.
> > > For default privileged containers the config file is
> > > /var/lib/lxc/$containername/config
> > He did meantion LXD explicitly.
> > There's no "config" in LXD containers. Which I find a certain deficiency of
> > the design. If I can't get a backup of entire container together with
> > config,
> > it has no use for me.
> >
> > --
> > With best regards,
> > Andrey Repin
> > Tuesday, May 5, 2015 19:23:34
> > Sorry for my terrible english...
> 
> 
> M.Ozan Hazer

> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20150506/e99d752f/attachment.sig>


More information about the lxc-users mailing list