Create lxc container with lxc-create
lxc-create is used to create lxc container. To create a container, run
1 |
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
1 2 |
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
1 |
lxc-ls -f |
To start a container, run
1 |
lxc-start NAME |
To connect to a container, use the command
1 |
lxc-attach NAME |
Example
1 2 3 4 5 |
root@b24:~# lxc-attach boby2 root@boby2:~# cat /etc/*issue Debian GNU/Linux 10 \n \l root@boby2:~# |
To delete a container, run
1 |
lxc-destroy NAME |
See lxc