Table of Contents

Linux Containers (LXC)

Administration

Start / Stop

Daemonize LXC container

lxc-start -d -n

Autostart

/var/lib/lxc/CONTAINERNAME/config
lxc.group = onboot
# Autostart
lxc.start.auto = 1
lxc.start.delay = 5
lxc.start.order = 100
/etc/default/lxc
LXC_AUTO="true"
# BOOTGROUPS - What groups should start on bootup?
#	Comma separated list of groups.
#	Leading comma, trailing comma or embedded double
#	comma indicates when the NULL group should be run.
# Example (default): boot the onboot group first then the NULL group
BOOTGROUPS="onboot,"

Konsole

Mit der Root-Konsole eines Systemcontainers verbinden

lxc-attach -n name

Erstellen

lxc-create -t template -n name

Liste der Templates:

ls /usr/share/lxc/templates

Ubuntu

Release festlegen:

lxc-create -n name -t ubuntu-cloud -- -r wily

(wily mit dem Release ersetzen)

troubleshooting

LXC doesn't work behind corporate proxy

If your lxc-create download hangs somewhere along those lines:

[…]
Downloading ubuntu bionic minimal ...
W: Target architecture is the same as host architecture; disabling QEMU support
I: Running command: debootstrap --arch amd64 --verbose --components=main,universe --include=apt-transport-https,ssh,vim,language-pack-en bionic /var/cache/lxc/bionic/partial-amd64 http://archive.ubuntu.com/ubuntu
I: Target architecture can be executed
W: Cannot check Release signature; keyring file not available /usr/share/keyrings/ubuntu-archive-keyring.gpg
I: Retrieving InRelease

And you have a corporate proxy, e.g. CNTLM, you have to set the following variables in wgetrc:

/etc/wgetrc
# You can set the default proxies for Wget to use for http, https, and ftp.
# They will override the value in the environment.
https_proxy = http://127.0.0.1:3128
http_proxy = http://127.0.0.1:3128
ftp_proxy = http://127.0.0.1:3128