[Lxc-users] lxc-execute-ephemeral?

Dan Kegel dank at kegel.com
Thu Aug 23 21:00:33 UTC 2012


On Thu, Aug 23, 2012 at 1:50 PM, Dan Kegel <dank at kegel.com> wrote:
> On Thu, Aug 23, 2012 at 1:32 PM, Dan Kegel <dank at kegel.com> wrote:
>> at the start of a build, use lxc-start-ephemeral -d to start the
>> ephemeral container,
>
> It's somewhat annoying to parse out the name of the
> ephemeral container from the log.  Is there a right
> way to get it?  (Or can it be passed in as a parameter?)

Here's a little demo.  Please poke holes in it and tell me how to
really do this :-)

#!/bin/sh
sudo lxc-start-ephemeral -o test-container2 -d > log 2>&1
while ! grep "is running" log
do
    sleep 1
done
container=`awk '/is running/ {print $1}' log`
sudo chroot /var/lib/lxc/$container/rootfs touch /xyzzy
sudo chroot /var/lib/lxc/$container/rootfs ls -l /xyzzy
sudo lxc-stop --name $container




More information about the lxc-users mailing list