sudo lxc-create -t ubuntu -n example_container
This creates a container based on the current ubuntu installation, and names it example_container. The container is placed in /var/lib/lxc/example_container, and the root file system is placed in /var/lib/lxc/example_container/rootfs.
sudo lxc-create -t ubuntu -n example_container -P /opt/lxc_containers --dir=/opt/lxc_containers/example_container/rootfs
This creates a container based on the current ubuntu installation, and names it example_container. The container configuration files are placed in /opt/lxc_containers/example_container and the root file system is placed in /opt/lxc_container/example_container/rootfs
#lists all containers found in /var/lib/lxc. sudo lxc-ls --fancy #lists all containers found in /opt/lxc_containers. sudo lxc-ls -P /opt/lxc_containers --fancy
# Start container in the background sudo lxc-start -n example_container -d # Access the container by attaching to the containers console. # CTRL-a, q detaches again. sudo lxc-console -n example_container # ssh into container ssh ubuntu@<ip>
# Turn machine off, from inside the machine sudo poweroff # Kill machine from outside (cleanly) sudo lxc-stop -n example_container # Force kill machine from outside sudo lxc-stop -n example_container -k