# Install LXC
sudo apt-get install lxc
# Create a Linux Container named base ( -t: template, -n: namespace )
sudo lxc-create -t ubuntu -n base
# Start the Linux Container ( -d: daemon )
sudo lxc-start -n base -d
# Stop the Linux Container
sudo lxc-stop -n base
# List Linux Containers
lxc-ls --fancy
# Clone the Linux Container
lxc-clone -o base -n newvm1
# Access the container
lxc-console -n newvm1
# Shudown
lxc-shutdown -n test-container
# Destroy
lxc-destroy -n test-container
LXC can be controlled via Libvirt:
http://blog.scottlowe.org/2013/11/27/linux-containers-via-lxc-and-libvirt/
Exploring LXC Networking:
Autostart
By default, containers will not be started after a reboot, even if they were running prior to the shutdown.To make a container autostart, you simply need to symlink its config file into the /etc/lxc/auto directory:
ln -s /var/lib/lxc/test-container/config /etc/lxc/auto/test-container.conf
Reference:
https://www.digitalocean.com/community/articles/getting-started-with-lxc-on-an-ubuntu-13-04-vps
http://www.janoszen.com/2013/05/14/lxc-tutorial/
No comments:
Post a Comment