LXD

From ALT Linux Wiki
Revision as of 16:47, 10 July 2019 by Obirvalger (talk | contribs) (Created page with "[https://linuxcontainers.org/lxd/introduction/ LXD] is a next generation system container manager. It offers a user experience similar to virtual machines but using Linux cont...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

LXD is a next generation system container manager. It offers a user experience similar to virtual machines but using Linux containers instead.

Install and setup

Install package lxd.

# apt-get install lxd

Add uid and gid map into files /etc/subuid и /etc/subgid:

root:100000:65536
lxd:100000:65536

Start and enable lxd service.

# systemctl enable --now lxd

Run initial setup.

# lxd init

Add user to lxd group.

# usermod username --append --groups lxd

Launch

Available ALT images on images.linuxcontainers.org

$ lxc image list images:alt

Approximate output:

alt/Sisyphus (3 more) a6bb3268c7a1 yes Alt Sisyphus amd64 (20190710_01:17) x86_64 227.27MB "Jul 10 2019 at 12:00am (UTC)"
alt/Sisyphus/arm64 (1 more) 4d860461a016 yes Alt Sisyphus arm64 (20190710_01:17) aarch64 177.23MB "Jul 10 2019 at 12:00am (UTC)"
alt/Sisyphus/i386 (1 more) 62d0664ce372 yes Alt Sisyphus i386 (20190710_01:17) i686 183.37MB "Jul 10 2019 at 12:00am (UTC)"
alt/Sisyphus/ppc64el (1 more) 143672c92ab2 yes Alt Sisyphus ppc64el (20190710_01:17) ppc64le 183.72MB "Jul 10 2019 at 12:00am (UTC)"
alt/p8 (3 more) b6674565b63b yes Alt p8 amd64 (20190710_01:17) x86_64 231.58MB "Jul 10 2019 at 12:00am (UTC)"
alt/p8/i386 (1 more) 864957bdb260 yes Alt p8 i386 (20190710_01:17) i686 182.66MB "Jul 10 2019 at 12:00am (UTC)"
alt/p9 (3 more) 262a6ff9259c yes Alt p9 amd64 (20190710_01:17) x86_64 226.51MB "Jul 10 2019 at 12:00am (UTC)"
alt/p9/arm64 (1 more) 7643261d1273 yes Alt p9 arm64 (20190710_01:17) aarch64 176.94MB "Jul 10 2019 at 12:00am (UTC)"
alt/p9/i386 (1 more) 4faf887493d7 yes Alt p9 i386 (20190710_01:17) i686 183.38MB "Jul 10 2019 at 12:00am (UTC)"
alt/p9/ppc64el (1 more) df49ca8bf30a yes Alt p9 ppc64el (20190710_01:17) ppc64le 182.81MB "Jul 10 2019 at 12:00am (UTC)"

Images available for the following arches:

  • amd64
  • arm64
  • i386
  • ppc64el

Launch container.

$ lxc launch images:alt/p9 first

Check it created.

$ lxc ls

Get into it.

$ lxc exec first bash

Stop it.

$ lxc exec first

And delete.

$ lxc rm first

Build of images

LXD images buildings via distrobuilder.

# apt-get install distrobuilder
# distrobuilder build-lxd /usr/share/distrobuilder/examples/alt

Import image to lxd.

$ lxc image import lxd.tar.xz rootfs.squashfs --alias myimage