# HG changeset patch # User Oleksandr Gavenko # Date 1546123596 -7200 # Node ID 897bb1696e5f1d8df59569039604ee9082eb0205 # Parent 7de68fce3e7dddb1fd0c303f5ba69fbd65d33164 LXC releases. Supported templates. diff -r 7de68fce3e7d -r 897bb1696e5f lxc.rst --- a/lxc.rst Sat Dec 29 23:23:30 2018 +0200 +++ b/lxc.rst Sun Dec 30 00:46:36 2018 +0200 @@ -6,6 +6,24 @@ .. contents:: :local: +LXC releases +============ + +https://discuss.linuxcontainers.org/tags/release + Announces of LXC & LXD releases. +https://discuss.linuxcontainers.org/t/lxc-3-0-0-has-been-released/1449 + LXC 3.0.0 has been released. + +Supported templates +=================== + +https://github.com/lxc/lxc-templates + Old style template scripts for LXC (prefer distrobuilder). +https://github.com/lxc/distrobuilder + System container image builder for LXC and LXD. +https://brauner.github.io/2018/02/27/lxc-removes-legacy-template-build-system.html + Details about replacing template stripts. + Install LXC under Debian ======================== :: @@ -41,23 +59,49 @@ Create new container in LXC =========================== -``-t`` defines distro name, ``-n`` gives name for container for further -referencing, ``--`` allow pass options to template script, ``-r`` specifies -Debian release:: +Create container from template:: + + $ sudo lxc-create -t $TMPL -n $NAME -- $EXTRA_ARGS - $ sudo lxc-create -t debian -n debtest -- -r sid +.. note:: + * ``-t`` defines distro name + * ``-n`` gives name for container for further referencing + * everything after ``--`` is passed to template script + +Template name is based on file name from ``/usr/share/lxc/templates`` directory without ``lxc-`` +prefix. -In order to use another miror:: +List available templates with:: + + $ ls -alh /usr/share/lxc/templates/ + +Examples of container creation command:: - $ MIRROR=http://httpredir.debian.org/debian sudo lxc-create -t debian -n debtest -- -r sid + $ sudo lxc-create -t debian -n deb-sid -- -r sid --enable-non-free + $ sudo lxc-create -t debian -n deb-testing -- -r testing + $ sudo lxc-create -t debian -n deb-stable -- -r stable -a amd64 -Getting help for template specific options:: + $ sudo lxc-create -t alpine -n alpine-3.7 -- -r 3.7 + +Each template has own options, which can be passed after ``--``. To get help on template specific +options run:: $ /usr/share/lxc/templates/lxc-ubuntu -h $ /usr/share/lxc/templates/lxc-debian -h $ /usr/share/lxc/templates/lxc-alpine -h ... +For Debian in order to use another miror:: + + $ MIRROR=http://httpredir.debian.org/debian sudo lxc-create -t debian -n debtest -- -r sid + +Since LXC v3.0 sh-templates moved to separate project and only 4 are left supported:: + + $ lxc-create my-busybox -t busybox + $ lxc-create my-x -t download + $ lxc-create c1 -t local -- --metadata /path/to/meta.tar.xz --fstree /path/to/rootfs.tar.xz + $ lxc-create c2 -t oci -- --url docker://alpine + Put ``veth`` network configuration into container config ``/var/lib/lxc/$NAME/config``:: lxc.network.type = veth