Difference between revisions of "User:1dent1ty"

From ArchWiki
Jump to: navigation, search
(Created page with "==Installation== ===Prerequisites=== The only required package is {{ic|lxc}}, however usage of container templates may require additional software, for example bundled lxc-arc...")
 
(Installation)
Line 1: Line 1:
 +
==Linux Containers page draft==
 
==Installation==
 
==Installation==
 
===Prerequisites===
 
===Prerequisites===

Revision as of 07:25, 8 April 2013

Linux Containers page draft

Installation

Prerequisites

The only required package is lxc, however usage of container templates may require additional software, for example bundled lxc-archlinux template require arch-install-scripts and lxc-ubuntu may require debootstrap and dpkg packages.

Host setup

Default root directory for lxc is /var/lib/lxc, this setting could be overriden via global configuration file. The rest of this page assumes default setting. To run containers at host startup and shutdown them gracefully use following service file:

$ cat /etc/systemd/system/lxc@.service
[Unit]
Description=%I Linux container
Wants=network.target
After=network.target
ConditionPathIsDirectory=/var/lib/lxc

[Service]
Type=simple
ExecStart=/usr/bin/lxc-start -n %I
ExecStop=/usr/bin/lxc-stop -n %I
Restart=on-failure
SuccessExitStatus=130

[Install]
WantedBy=multi-user.target

Starting container named lxc0 with such service file would be as simple as

 # systemctl start lxc@lxc0.service

Container installation

Containers are created with lxc-create utility. It provides user interface to create and set up container image and optionnaly sets up backing store. The only supported backing stores at the moment are existing filesystem directory (default), LVM logical volume and BTRFS subvolume. The only required parameter is container name, specified by -n or --name command line argument.

Container setup

Containers configuration resides in config file located at /var/lib/lxc/<container name>/ directory