Create lxc container with lxc-create

lxc-create is used to create lxc container. To create a container, run

lxc-create -t download -n CONTAINER_NAME_HERE

This will list all available containers. You can select the OS you want to use.

To specify OS, you can use the following examples

Advertisement

lxc-create -t download -n mycontainer-1 -- -d ubuntu -r focal -a amd64
lxc-create -t download -n mycontainer-2 -- -d debian -r buster -a amd64

To list all containers, run

lxc-ls -f

To start a container, run

lxc-start NAME

To connect to a container, use the command

lxc-attach NAME

Example

root@b24:~# lxc-attach boby2
root@boby2:~# cat /etc/*issue
Debian GNU/Linux 10 \n \l

root@boby2:~#

To delete a container, run

lxc-destroy NAME
Add a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement