NAME Linux::LXC - Manage your LXC containers. VERSION 1.0000 SYNOPSYS use Linux::LXC qw(ALLOW_UNDEF); my $c = Linux::LXC->new( utsname => 'web', template => 'download -- -d debian -r wheezy -a amd64' ); my ($uid_start, $uid_map) = $c->get_config('lxc.id_map', qr/^u 0 (\d+) (\d+)$/, ALLOW_UNDEF); $c->stop if $c->is_running; $c->destroy if $c->is_existing; $c->deploy; $c->set_config('lxc.network.ipv4', '10.0.3.2'); $c->start; my @cmd = ( 'route add default gw 10.0.0.3 eth0', 'echo "nameserver 8.8.8.8" > /etc/resolv.conf', 'apt-get update -y', 'apt-get install -y lighttpd' ); map { my ($res, $stdout, $stderr) = $c->exec($_); die $stderr if $stderr ne ''; } @cmd; $c->put('lighttpd.conf', '/etc/lighttpd/lighttpd.conf'); $c->put('www', '/var/www'); DESCRIPTION This module helps you to manage LXC container. Each container will be represented by an object of this module. Some module subroutine are also usable without any object instance. Module subroutines get_existing_containers() Will return an array with the name of all LXC containers existing on the system. get_running_containers() Will return an array with the name of all LXC containers currently running on the system. get_stopped_containers() Will return an array with the name of all LXC containers currently stopped on the system. Object methods new(%params) Instanciate a new Linux::LXC object. Params that can be initialized: utsname Mandatory parameter. Set the utsname of the container. template Mandatory only if you planned to deploy the container. Set the LXC template to use for deploying the container. return A Linux::LXC object. deploy() Will deploy the container. Concretly, this method will check that the container is not existing, and after execute `lxc-deploy -n -t