[lxc-devel] [RFC] lxc-start: daemonize by default

Serge Hallyn serge.hallyn at ubuntu.com
Wed Apr 30 13:56:17 UTC 2014


Quoting Christian Seiler (christian at iwakd.de):
> Hi,
> 
> I'd like to hear some comments about the following:
> 
> With the release of LXC 1.0, lxc-shutdown and lxc-stop were merged
> and now we have a really nice sane default to stopping containers:
> Just run lxc-stop -n $container and LXC will try to shut down the
> container and after a default of 60s it will forcibly kill it.
> This is a very reasonable default for most things one does with
> LXC, so this has become really user-friendly.
> 
> However, from personal experience, lxc-start is not quite as user-
> friendly. In >95% of cases, I want to start a container in the
> background and keep it running. There are some cases where I want
> to have it in the foreground and get the output immediately, but
> that is the exception (I am not talking about lxc-execute here,
> just about lxc-start).
> 
> It has been several times that I have accidentally run lxc-start
> without the -d flag and then had to shut the container down again
> only to immediately try again with -d. Therefore, at least from
> the way I use LXC, it seems to me to be much more sensible to
> have lxc-start daemonize by default and instead provide flag to
> keep it in the foreground, which seems to be a use case that is
> rare in comparison.
> 
> Obviously, this shouldn't be done for the 1.0 branch, since this
> breaks the given interface. But could we think about this for
> the next release (or, if you want to be conservative, the
> release after that with a warning in the next)? Thoughts?
> 
> Regards,
> Christian

And make -F mean 'foreground a console'?

So long as we continue to support '-d' (ignoring it), I suppose
it shouldn't break anyone's scripts, as scripts presumably are
backgrounding containers now :)  We might at that point want to
add a pair of options, one to return only once the container is
in RUNNING state, and another to only return when SOME_PROGRAM
returns - where SOME_PROGRAM might be waiting for an init
script in the container to write 'ready' to a socket bound from
the host - that way we know that the container has entered
runlevel 2 or whatever.

-serge


More information about the lxc-devel mailing list