lost and found ( for me ? )

Ubuntu 14.04 : nested LXC


Here is how to run LXC within LXC

install lxc
# apt-get install lxc

create a container named “trusty”
# lxc-create -t ubuntu -n trusty

# The default user is 'ubuntu' with password 'ubuntu'!
# Use the 'sudo' command to run tasks as root in the container.


# lxc-ls –fancy
trusty  STOPPED  -     -     NO

add lxc.mount.auto and lxc.aa_profile options into the config file of that container.
# echo "lxc.mount.auto = cgroup" >> /var/lib/lxc/trusty/config
# echo "lxc.aa_profile = lxc-container-default-with-nesting" >> /var/lib/lxc/trusty/config

If you want to allow all of containers to do the nesting, you can enable that globally by adding two options into global configuration file “/etc/lxc/default.conf”.

start the container
# lxc-start -n trusty

root@trusty:~# apt-get install lxc

install LXC into the container “trusty”
root@trusty:~# apt-get install lxc

root@trusty:~# lxc-create -t ubuntu -n ubuntu-nested

root@trusty:~# lxc-start -n ubuntu-nested

on the host ( not LXC ),
# lxc-ls --fancy –nesting
NAME               STATE    IPV4                  IPV6  AUTOSTART
trusty             RUNNING,  -     NO
\_ ubuntu-nested  RUNNING            -     NO

the container “ubuntu-netsted” is running within the container “trusty”.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.