[lxc-users] Python and lxc

Serge Hallyn serge.hallyn at ubuntu.com
Mon Mar 7 08:50:53 UTC 2016


Quoting Valeriy Solovyov (weldpua2008 at gmail.com):
> Hi all,
> 
> I am using python to start container:
>     cmd = "lxc-start -n %s -d " % CT_ID
>     handler = subprocess.Popen(
>         cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
>     stdout, stderr = handler.communicate()
>     returncode = handler.returncode
> 
> After that the behavior of terminal changes and I need to run command:
> reset.
> 
> Also I am using python wrapper(https://github.com/frougon/pythondialog) for
> dialog and when I make dialog guage like in this example
> https://github.com/frougon/pythondialog/blob/master/examples/demo.py#L740
> it is freezing after gauge_stop()
> https://github.com/frougon/pythondialog/blob/master/dialog.py#L2550
> 
> If I don't use lxc-start it's ok.

I'd recommend using the python bindings:

import lxc
c = lxc.Container(CT_ID)
c.start()


More information about the lxc-users mailing list