MoinMoin Logo
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

Navigation

  • Start
  • Sitemap
Revision 15 as of 2022-02-26 23:14:26
  • lxc

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

   1 2016-11-08T23:39 root@nb200:/tmp
   2 $ lxc-create -t download -n containerx -- -d ubuntu  -r precise -a i386
   3 Setting up the GPG keyring
   4 Downloading the image index
   5 Downloading the rootfs
   6 Downloading the metadata
   7 The image cache is now ready
   8 Unpacking the rootfs
   9 
  10 ---
  11 You just created an Ubuntu container (release=precise, arch=i386, variant=default)
  12 
  13 To enable sshd, run: apt-get install openssh-server
  14 
  15 For security reason, container images ship without user accounts
  16 and without a root password.
  17 
  18 Use lxc-attach or chroot directly into the rootfs to set a root password
  19 or create user accounts.
  20 # start a container
  21 lxc-start -n containerx -d
  22 # list containers
  23 lxc-ls --fancy
  24 # spawn a new shell running inside an existing container
  25 lxc-attach -n containerx
  26 
  27 # session in containerx 
  28 root@containerx:/etc# cat /etc/os-release 
  29 NAME="Ubuntu"
  30 VERSION="12.04.5 LTS, Precise Pangolin"
  31 ID=ubuntu
  32 ID_LIKE=debian
  33 PRETTY_NAME="Ubuntu precise (12.04.5 LTS)"
  34 VERSION_ID="12.04"
  35 
  36 # run several commands in the container
  37 lxc-attach -n containerx -- sh -c 'TESTFILE=/tmp/asd;cat $TESTFILE; echo $TESTFILE'
  38 lxc-attach -n containerx -- sh -c 'cat /etc/os-release; dpkg -l;'
  39 # containers are stored under  /var/lib/lxc/
  40 

Containers in Slackware64 15.0

  • https://linuxcontainers.org/lxc/manpages/man5/lxc.container.conf.5.html

  • https://docs.slackware.com/howtos:misc:lxc

   1 su
   2 # list available templates and distros
   3 lxc-create -t download -n NAME
   4 #Setting up the GPG keyring
   5 #Downloading the image index
   6 #
   7 #---
   8 #DIST   RELEASE ARCH    VARIANT BUILD
   9 #---
  10 #almalinux      8       amd64   default 20220224_23:09
  11 #almalinux      8       arm64   default 20220224_23:09
  12 #alpine 3.12    amd64   default 20220225_13:00
  13 #alpine 3.12    arm64   default 20220225_13:01
  14 #alpine 3.12    armhf   default 20220225_13:00
  15 #alpine 3.12    i386    default 20220225_13:01
  16 # press ctrl+c to exit
  17 lxc-create -t download -n containery -- -d ubuntu  -r bionic -a i386
  18 lxc-start -n containery -d
  19 lxc-ls --fancy
  20 lxc-attach -n containery
  21 # in the container
  22 lsb_release -a
  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01