I'm having difficulty overseeing the possibilities of howto deploy an application on to a fresh LXC container.

Say I have a fresh LXC container, how would I provision it with my to-be deployed application?

  1. Am I working against the intended use of LXC to start a new container for a new deployment? i.e., should I instead be looking at containers as long running just like a VM?
  2. I'd like to use Ansible, but the methods of actually interfacing with a lxc container are limited. Modules bundled in Ansible allow you to start, stop, create a container, but actually installing software in the container is hard because a clean container does not allow to be accessed through SSH. Does anyone have success deploying with ansible to LXC without needing to write a lot of glue code?

Check ansible-lxc-ssh connection plugin:

This plugin allows to use Ansible on a remote server hosting LXC containers, without having to install SSH servers in each LXC container.

The plugin connects to the host using SSH, then uses lxc-attach to enter the container. This means the SSH connection must login as root, otherwise lxc-attach will fail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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