Closed sethdmoore closed 7 years ago
Just a minor correction, you don't actually need to first create the container for execute to work, but you need to provide some configuration, for instance
lxc-execute -n u1 -s lxc.rootfs=./rootfs -s lxc.network.type=none -- /bin/sh
I believe https://github.com/lxc/go-lxc/commit/89b06ca6fad6daea5a72a1f47e69e39716c46198 fixed this issue. Closing now.
No matter how you invoke it, the Execute method fails.
The example in the v2 branch of the project folder fails, since it does not first create a container
Here is a code example using NewContainer, Create and Execute method. Always fails with "container already defined" https://gist.github.com/sethdmoore/bf4d6e332ec1418c567ddfc9294bd9c6
This is due to the check on these lines: https://github.com/lxc/go-lxc/blob/v2/container.go#L457-L459
According to the lxc-execute(1) man page, " lxc-execute runs the specified command inside the container specified by name. It will setup the container according to the configuration previously defined with the lxc-create command or with the configuration file parameter."
lxc-execute(1) without lxc-create first fails on my machine
If I create the container first, it works
System / Package / Etc below