1.5 KiB
1.5 KiB
LXC
Installation
On debian install it using snap it is the preferred way.
Initialization:
Follow this tutorial to set up lxd.
Launch and list containers:
lxc launch ubuntu:22.04 <container-name>
lxc list
to stop a container:
lxc stop <container-name>
to delete a container:
lxc delete <container-name>
Setup static ip for container:
lxc config device override <container-name> eth0
lxc config device set <container-name> eth0 ipv4.address <container-ip>
Start a shell inside a container:
lxc shell <container-name>
Exposing container to the public:
Todo, for now follow linked tutorial. Host it on your own.
Running Docker inside lxc:
Firstly you need to create storage device:
lxc sorage create <volume-name> btrfs
lxc launch images:ubuntu/22.04 <container-name>
Then add this storage device to container:
lxc config device add <container-name> docker disk pool=<volume-name> source=<container-name> path=/var/lib/docker
Then set privileges for docker to have ability to call syscalls.
lxc config set <container-name> security.nesting=true security.syscalls.intercept.mknod=true security.syscalls.intercept.setxattr=true
lxc restart <container-name>
or read this tutorial.