mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 02:51:16 +00:00
* drvlxc.html.in drvlxc.html: some examples from Serge Hallyn
daniel
This commit is contained in:
parent
14687aad81
commit
a28a644680
@ -1,3 +1,7 @@
|
|||||||
|
Wed Apr 15 21:59:09 CEST 2009 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
|
* drvlxc.html.in drvlxc.html: some examples from Serge Hallyn
|
||||||
|
|
||||||
Wed Apr 15 11:52:15 CEST 2009 Daniel Veillard <veillard@redhat.com>
|
Wed Apr 15 11:52:15 CEST 2009 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
* src/xm_internal.c: fix a crash on vcpupin to inactive Xen domains,
|
* src/xm_internal.c: fix a crash on vcpupin to inactive Xen domains,
|
||||||
|
@ -126,6 +126,81 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<h1>LXC container driver</h1>
|
<h1>LXC container driver</h1>
|
||||||
|
<p>
|
||||||
|
The libvirt LXC driver manages "Linux Containers". Containers are sets of processes
|
||||||
|
with private namespaces which can (but don't always) look like separate machines, but
|
||||||
|
do not have their own OS. Here are two example configurations. The first is a very
|
||||||
|
light-weight "application container" which does not have it's own root image. You would
|
||||||
|
start it using
|
||||||
|
</p>
|
||||||
|
<h3>Example config version 1</h3>
|
||||||
|
<p></p>
|
||||||
|
<pre>
|
||||||
|
<domain type='lxc'>
|
||||||
|
<name>vm1</name>
|
||||||
|
<memory>500000</memory>
|
||||||
|
<os>
|
||||||
|
<type>exe</type>
|
||||||
|
<init>/bin/sh</init>
|
||||||
|
</os>
|
||||||
|
<vcpu>1</vcpu>
|
||||||
|
<clock offset='utc'/>
|
||||||
|
<on_poweroff>destroy</on_poweroff>
|
||||||
|
<on_reboot>restart</on_reboot>
|
||||||
|
<on_crash>destroy</on_crash>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/libexec/libvirt_lxc</emulator>
|
||||||
|
<interface type='network'>
|
||||||
|
<source network='default'/>
|
||||||
|
</interface>
|
||||||
|
<console type='pty' />
|
||||||
|
</devices>
|
||||||
|
</domain>
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
The next example assumes there is a private root filesystem
|
||||||
|
(perhaps hand-crafted using busybox, or installed from media,
|
||||||
|
debootstrap, whatever) under /opt/vm-1-root:
|
||||||
|
</p>
|
||||||
|
<p></p>
|
||||||
|
<pre>
|
||||||
|
<domain type='lxc'>
|
||||||
|
<name>vm1</name>
|
||||||
|
<memory>32768</memory>
|
||||||
|
<os>
|
||||||
|
<type>exe</type>
|
||||||
|
<init>/init</init>
|
||||||
|
</os>
|
||||||
|
<vcpu>1</vcpu>
|
||||||
|
<clock offset='utc'/>
|
||||||
|
<on_poweroff>destroy</on_poweroff>
|
||||||
|
<on_reboot>restart</on_reboot>
|
||||||
|
<on_crash>destroy</on_crash>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/libexec/libvirt_lxc</emulator>
|
||||||
|
<filesystem type='mount'>
|
||||||
|
<source dir='/opt/vm-1-root'/>
|
||||||
|
<target dir='/'/>
|
||||||
|
</filesystem>
|
||||||
|
<interface type='network'>
|
||||||
|
<source network='default'/>
|
||||||
|
</interface>
|
||||||
|
<console type='pty' />
|
||||||
|
</devices>
|
||||||
|
</domain>
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
In both cases, you can define and start a container using:</p>
|
||||||
|
<pre>
|
||||||
|
lxc --connect lxc:/// define v1.xml
|
||||||
|
lxc --connect lxc:/// start v1.xml
|
||||||
|
</pre>
|
||||||
|
<pre>
|
||||||
|
lxc --connect lxc:/// console v1
|
||||||
|
</pre>
|
||||||
|
<p>Now doing 'ps -ef' will only show processes in the container, for
|
||||||
|
instance.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
|
@ -1,5 +1,84 @@
|
|||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
<h1>LXC container driver</h1>
|
<h1>LXC container driver</h1>
|
||||||
|
<p>
|
||||||
|
The libvirt LXC driver manages "Linux Containers". Containers are sets of processes
|
||||||
|
with private namespaces which can (but don't always) look like separate machines, but
|
||||||
|
do not have their own OS. Here are two example configurations. The first is a very
|
||||||
|
light-weight "application container" which does not have it's own root image. You would
|
||||||
|
start it using
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h3>Example config version 1</h3>
|
||||||
|
<p></p>
|
||||||
|
<pre>
|
||||||
|
<domain type='lxc'>
|
||||||
|
<name>vm1</name>
|
||||||
|
<memory>500000</memory>
|
||||||
|
<os>
|
||||||
|
<type>exe</type>
|
||||||
|
<init>/bin/sh</init>
|
||||||
|
</os>
|
||||||
|
<vcpu>1</vcpu>
|
||||||
|
<clock offset='utc'/>
|
||||||
|
<on_poweroff>destroy</on_poweroff>
|
||||||
|
<on_reboot>restart</on_reboot>
|
||||||
|
<on_crash>destroy</on_crash>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/libexec/libvirt_lxc</emulator>
|
||||||
|
<interface type='network'>
|
||||||
|
<source network='default'/>
|
||||||
|
</interface>
|
||||||
|
<console type='pty' />
|
||||||
|
</devices>
|
||||||
|
</domain>
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The next example assumes there is a private root filesystem
|
||||||
|
(perhaps hand-crafted using busybox, or installed from media,
|
||||||
|
debootstrap, whatever) under /opt/vm-1-root:
|
||||||
|
</p>
|
||||||
|
<p></p>
|
||||||
|
<pre>
|
||||||
|
<domain type='lxc'>
|
||||||
|
<name>vm1</name>
|
||||||
|
<memory>32768</memory>
|
||||||
|
<os>
|
||||||
|
<type>exe</type>
|
||||||
|
<init>/init</init>
|
||||||
|
</os>
|
||||||
|
<vcpu>1</vcpu>
|
||||||
|
<clock offset='utc'/>
|
||||||
|
<on_poweroff>destroy</on_poweroff>
|
||||||
|
<on_reboot>restart</on_reboot>
|
||||||
|
<on_crash>destroy</on_crash>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/libexec/libvirt_lxc</emulator>
|
||||||
|
<filesystem type='mount'>
|
||||||
|
<source dir='/opt/vm-1-root'/>
|
||||||
|
<target dir='/'/>
|
||||||
|
</filesystem>
|
||||||
|
<interface type='network'>
|
||||||
|
<source network='default'/>
|
||||||
|
</interface>
|
||||||
|
<console type='pty' />
|
||||||
|
</devices>
|
||||||
|
</domain>
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
In both cases, you can define and start a container using:</p>
|
||||||
|
<pre>
|
||||||
|
lxc --connect lxc:/// define v1.xml
|
||||||
|
lxc --connect lxc:/// start v1.xml
|
||||||
|
</pre>
|
||||||
|
and then get a console using:
|
||||||
|
<pre>
|
||||||
|
lxc --connect lxc:/// console v1
|
||||||
|
</pre>
|
||||||
|
<p>Now doing 'ps -ef' will only show processes in the container, for
|
||||||
|
instance.
|
||||||
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user