Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a question about LXC Containers.

I have some containers, if I lxc-start them, they come up with networking fine, but I want to just be able to run commands against them using lxc-execute, without starting the whole thing. However, when I do this, there is no connectivity? - I guess as doesnt run init. How can I fix this?

share|improve this question

1 Answer 1

You're right, the network is not setup because lxc-execute just creates the container and runs your application. lxc-start runs /sbin/init, which takes care of the nitty-gritty.

You can use a script that sets up networking and then executes whatever you give it as the first parameter, something like:

ifup -a
if [ -x "$1" ]; then
    exec "$1"
fi
echo "Something went wrong."

You could also configure the network parameters in the container configuration. In this case LXC will set up the network before it runs your application.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.