lxc.conf.sgml.in revision ac7725e7bb6753087aa63bbefb999529b0625212
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březinalxc: linux Container library
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina(C) Copyright IBM Corp. 2007, 2008
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel BřezinaDaniel Lezcano <dlezcano at fr.ibm.com>
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel BřezinaThis library is free software; you can redistribute it and/or
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březinamodify it under the terms of the GNU Lesser General Public
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel BřezinaLicense as published by the Free Software Foundation; either
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březinaversion 2.1 of the License, or (at your option) any later version.
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel BřezinaThis library is distributed in the hope that it will be useful,
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březinabut WITHOUT ANY WARRANTY; without even the implied warranty of
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel BřezinaMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel BřezinaLesser General Public License for more details.
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel BřezinaYou should have received a copy of the GNU Lesser General Public
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel BřezinaLicense along with this library; if not, write to the Free Software
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel BřezinaFoundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina<!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina <docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina linux container configuration file
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina </refpurpose>
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina </refnamediv>
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina The linux containers (<command>lxc</command>) are always created
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina before being used. This creation defines a set of system
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina resources to be virtualized / isolated when a process is using
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina the container. By default, the pids, sysv ipc and mount points
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina are virtualized and isolated. The other system resources are
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina shared across containers, until they are explicitly defined in
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina the configuration file. For example, if there is no network
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina configuration, the network will be shared between the creator of
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina the container and the container itself, but if the network is
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina specified, a new network stack is created for the container and
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina the container can no longer use the network of its ancestor.
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina The configuration file defines the different system resources to
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina be assigned for the container. At present, the utsname, the
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina network, the mount points, the root file system and the control
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina groups are supported.
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina Each option in the configuration file has the form <command>key
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina = value</command> fitting in one line. The '#' character means
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina the line is a comment.
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina Allows to set the architecture for the container. For example,
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina set a 32bits architecture for a container running 32bits
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina binaries on a 64bits host. That fix the container scripts
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina which rely on the architecture to do some work like
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina downloading the packages.
573e86dc3156e481ce53d39ac901da2e99cfa0caJakub Hrozek <variablelist>
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina <varlistentry>
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina Specify the architecture for the container.
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina Valid options are
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina </varlistentry>
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina </variablelist>
573e86dc3156e481ce53d39ac901da2e99cfa0caJakub Hrozek The utsname section defines the hostname to be set for the
573e86dc3156e481ce53d39ac901da2e99cfa0caJakub Hrozek container. That means the container can set its own hostname
87f8bee53ee1b4ca87b602ff8536bc5fd5b5b595Lukas Slebodnik without changing the one from the system. That makes the
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina hostname private for the container.
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina <variablelist>
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina <varlistentry>
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina specify the hostname for the container
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina </varlistentry>
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina </variablelist>
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina The network section defines how the network is virtualized in
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina the container. The network virtualization acts at layer
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina two. In order to use the network virtualization, parameters
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina must be specified to define the network interfaces of the
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina container. Several virtual interfaces can be assigned and used
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina in a container even if the system has only one physical
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina network interface.
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina <variablelist>
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina <varlistentry>
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina specify what kind of network virtualization to be used
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina for the container. Each time
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina a <option>lxc.network.type</option> field is found a new
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina round of network configuration begins. In this way,
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov several network virtualization types can be specified
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina for the same container, as well as assigning several
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina network interfaces for one container. The different
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina virtualization types can be:
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina <option>empty:</option> will create only the loopback
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina <option>veth:</option> a peer network device is created
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina with one side assigned to the container and the other
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina side is attached to a bridge specified by
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina the <option>lxc.network.link</option>. If the bridge is
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina not specified, then the veth pair device will be created
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina but not attached to any bridge. Otherwise, the bridge
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina has to be setup before on the
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina system, <command>lxc</command> won't handle any
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina configuration outside of the container. By
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina default <command>lxc</command> choose a name for the
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina network device belonging to the outside of the
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina container, this name is handled
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina by <command>lxc</command>, but if you wish to handle
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina this name yourself, you can tell <command>lxc</command>
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina to set a specific name with
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina the <option>lxc.network.veth.pair</option> option.
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina <option>vlan:</option> a vlan interface is linked with
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina the interface specified by
46d3d2c731e8c7e138462e5b60a39a279dc77d81Pavel Březina the <option>lxc.network.link</option> and assigned to
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina the container. The vlan identifier is specified with the
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina <option>macvlan:</option> a macvlan interface is linked
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina with the interface specified by
5ff1c3c5a12930692cb6284d14f7fda3a974af8ePavel Březina the <option>lxc.network.link</option> and assigned to
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina the container.
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina <option>lxc.network.macvlan.mode</option> specifies the
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina mode the macvlan will use to communicate between
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina different macvlan on the same upper device. The accepted
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina modes are <option>private</option>, the device never
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina communicates with any other device on the same upper_dev (default),
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina <option>vepa</option>, the new Virtual Ethernet Port
5ff1c3c5a12930692cb6284d14f7fda3a974af8ePavel Březina Aggregator (VEPA) mode, it assumes that the adjacent
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina bridge returns all frames where both source and
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina destination are local to the macvlan port, i.e. the
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina bridge is set up as a reflective relay. Broadcast
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina frames coming in from the upper_dev get flooded to all
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov macvlan interfaces in VEPA mode, local frames are not
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina delivered locallay, or <option>bridge</option>, it
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina provides the behavior of a simple bridge between
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina different macvlan interfaces on the same port. Frames
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina from one interface to another one get delivered directly
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina and are not sent out externally. Broadcast frames get
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina flooded to all other bridge ports and to the external
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina interface, but when they come back from a reflective
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina relay, we don't deliver them again. Since we know all
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina the MAC addresses, the macvlan bridge mode does not
573e86dc3156e481ce53d39ac901da2e99cfa0caJakub Hrozek require learning or STP like the bridge module does.
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina <option>phys:</option> an already existing interface
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina specified by the <option>lxc.network.link</option> is
7379170a0860790f2739e07fffe3d6ec85264566Pavel Březina assigned to the container.
46d3d2c731e8c7e138462e5b60a39a279dc77d81Pavel Březina </varlistentry>
46d3d2c731e8c7e138462e5b60a39a279dc77d81Pavel Březina <varlistentry>
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina specify an action to do for the
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina <para><option>up:</option> activates the interface.
573e86dc3156e481ce53d39ac901da2e99cfa0caJakub Hrozek </varlistentry>
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina <varlistentry>
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina specify the interface to be used for real network
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina </varlistentry>
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina <varlistentry>
15d41c8f28259061e39715acdbbbaea778b6ecc8Pavel Březina the interface name is dynamically allocated, but if
15d41c8f28259061e39715acdbbbaea778b6ecc8Pavel Březina another name is needed because the configuration files
15d41c8f28259061e39715acdbbbaea778b6ecc8Pavel Březina being used by the container use a generic name,
15d41c8f28259061e39715acdbbbaea778b6ecc8Pavel Březina eg. eth0, this option will rename the interface in the
15d41c8f28259061e39715acdbbbaea778b6ecc8Pavel Březina </varlistentry>
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina <varlistentry>
15d41c8f28259061e39715acdbbbaea778b6ecc8Pavel Březina the interface mac address is dynamically allocated by
46d3d2c731e8c7e138462e5b60a39a279dc77d81Pavel Březina default to the virtual interface, but in some cases,
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina this is needed to resolve a mac address conflict or to
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina always have the same link-local ipv6 address
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina </varlistentry>
15d41c8f28259061e39715acdbbbaea778b6ecc8Pavel Březina <varlistentry>
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina specify the ipv4 address to assign to the virtualized
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina interface. Several lines specify several ipv4 addresses.
710472d946f6c337a095699dfd79134fa8b9eab9Pavel Březina The address is in format x.y.z.t/m,
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov eg. 192.168.1.123/24. The broadcast address should be
15d41c8f28259061e39715acdbbbaea778b6ecc8Pavel Březina specified on the same line, right after the ipv4
15d41c8f28259061e39715acdbbbaea778b6ecc8Pavel Březina </varlistentry>
d38ffc9c92daeb62de7d28c409bdaeff98f82775Pavel Březina <varlistentry>
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina specify the ipv4 address to use as the gateway inside the
container. The address is in format x.y.z.t, eg.
rootfs. If lxc.autodev is set to 1, then after mounting the container's
of the rootfs, i.e. to mount an encrypted filesystem. Mounts
mounted to the rootfs.mount location.
lxc.utsname = myhostname
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.name = eth0
lxc.network.hwaddr = 4a:49:43:49:79:bf
lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3597
lxc.id_map = u 0 100000 10000
lxc.id_map = g 0 100000 10000
the application, cpuset.cpus restricts usage of the defined cpu,
lxc.cgroup.cpuset.cpus = 0,1
lxc.cgroup.cpu.shares = 1234
lxc.cgroup.devices.allow = c 1:3 rw
lxc.cgroup.devices.allow = b 8:0 rw
lxc.utsname = complex
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.hwaddr = 4a:49:43:49:79:bf
lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3597
lxc.network.ipv6 = 2003:db8:1:0:214:5432:feab:3588
lxc.network.type = macvlan
lxc.network.flags = up
lxc.network.link = eth0
lxc.network.hwaddr = 4a:49:43:49:79:bd
lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596
lxc.network.type = phys
lxc.network.flags = up
lxc.network.link = dummy0
lxc.network.hwaddr = 4a:49:43:49:79:ff
lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3297
lxc.cgroup.cpuset.cpus = 0,1
lxc.cgroup.cpu.shares = 1234
lxc.cgroup.devices.allow = c 1:3 rw
lxc.cgroup.devices.allow = b 8:0 rw
lxc.cap.drop = sys_module mknod setuid net_raw
lxc.cap.drop = mac_override