[Lxc-users] lxc-execute-ephemeral?

Serge Hallyn serge.hallyn at canonical.com
Thu Aug 23 21:10:00 UTC 2012


Quoting Dan Kegel (dank at kegel.com):
> On Thu, Aug 23, 2012 at 11:25 AM, Serge Hallyn
> <serge.hallyn at canonical.com> wrote:
> > Is your main objection the extra time it takes for the distro-provided
> > init to run over lxc-init, or using separate commands as you mention
> > above?
> 
> I'm still trying to figure out my requirements, and how to use lxc.
> Buildbot runs normally take at least a minute, so anything
> under ten seconds might be ok.  My main concern was
> how to issue commands to run inside the ephemeral container.
> I can make do with running a single command, but buildbot
> kind of wants to run several commands during a run, so
> starting, issuing multiple commands from outside the container,
> and then stopping would be a natural fit.
> 
> > lxc-start-ephemeral takes arguments to execute, so you can
> > just do
> >
> >   lxc-start-ephemeral -o q1 -- ps -ef
> >
> > which will create the container, run the command, and destroy the container,
> 
> Sounds good, but when I try it, I get prompted for root's password:
> 
> $ time sudo lxc-create -t ubuntu -n test-container2
> ...
> real	0m5.970s   (nice!)
> $ sudo lxc-start-ephemeral -o test-container2 -- ps -ef
> Setting up ephemeral container...
> unable to write 'random state'
> Starting up the container...
> Warning: Permanently added '10.0.3.175' (ECDSA) to the list of known hosts.
> root at 10.0.3.175's password:
> Permission denied, please try again.
> root at 10.0.3.175's password:

right, so do '-u <yourusername>' and it'll ssh into the container as you
instead.  Or chroot into /var/lib/lxc/test-container2/rootfs and set
root's password.

> I had to reboot (lxc-stop wasn't enough?) and do lxc-destroy to get
> rid of the ephemeral container.
> 
> So I'm not sure it's working quite as you indicated.  This is all on
> ubuntu-12.04,
> $ dpkg-query -W lxc
> lxc	0.7.5-3ubuntu62
> 
> If you have a clue you could lend me, I'd be grateful.
> 
> > If you want to use lxc-init, it an lxc-execute-ephemeral shouldn't be too
> > hard to whip up.
> 
> Hopefully I can make do with what's already there, once I figure out
> how to use it.
> - Dan




More information about the lxc-users mailing list