= lxc = Linux Containers * [[https://linuxcontainers.org/lxc/introduction/]] * [[http://www.cyberciti.biz/faq/how-to-create-unprivileged-linux-containers-on-ubuntu-linux/]] * [[http://en.wikipedia.org/wiki/LXC]] LXC (Linux Containers) is an operating system–level virtualization method for running multiple isolated Linux systems (containers) on a single control host. LXC provides operating system-level virtualization through a virtual environment that has its own process and network space, instead of creating a full-fledged virtual machine. == Ubuntu precise i386 container on Slackware 14.2 == {{{#!highlight bash 2016-11-08T23:39 root@nb200:/tmp $ lxc-create -t download -n containerx -- -d ubuntu -r precise -a i386 Setting up the GPG keyring Downloading the image index Downloading the rootfs Downloading the metadata The image cache is now ready Unpacking the rootfs --- You just created an Ubuntu container (release=precise, arch=i386, variant=default) To enable sshd, run: apt-get install openssh-server For security reason, container images ship without user accounts and without a root password. Use lxc-attach or chroot directly into the rootfs to set a root password or create user accounts. # start a container lxc-start -n containerx -d # list containers lxc-ls --fancy # spawn a new shell running inside an existing container lxc-attach -n containerx # session in containerx root@containerx:/etc# cat /etc/os-release NAME="Ubuntu" VERSION="12.04.5 LTS, Precise Pangolin" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu precise (12.04.5 LTS)" VERSION_ID="12.04" # run several commands in the container lxc-attach -n containerx -- sh -c 'TESTFILE=/tmp/asd;cat $TESTFILE; echo $TESTFILE' lxc-attach -n containerx -- sh -c 'cat /etc/os-release; dpkg -l;' # containers are stored under /var/lib/lxc/ }}} == Containers in Slackware64 15.0 == {{{#!highlight bash su # list available templates and distros lxc-create -t download -n NAME #Setting up the GPG keyring #Downloading the image index # #--- #DIST RELEASE ARCH VARIANT BUILD #--- #almalinux 8 amd64 default 20220224_23:09 #almalinux 8 arm64 default 20220224_23:09 #alpine 3.12 amd64 default 20220225_13:00 #alpine 3.12 arm64 default 20220225_13:01 #alpine 3.12 armhf default 20220225_13:00 #alpine 3.12 i386 default 20220225_13:01 # press ctrl+c to exit lxc-create -t download -n containery -- -d ubuntu -r bionic -a i386 lxc-start -n containery -d lxc-ls --fancy lxc-attach -n containery # in the container lsb_release -a }}}