]> git.proxmox.com Git - mirror_lxc.git/blame - doc/lxc-unshare.sgml.in
doc: improve Korean lxc-attach(1)
[mirror_lxc.git] / doc / lxc-unshare.sgml.in
CommitLineData
810567bb
SH
1<!--
2
3lxc: linux Container library
4
5(C) Copyright IBM Corp. 2007, 2008
6
7Authors:
9afe19d6 8Daniel Lezcano <daniel.lezcano at free.fr>
810567bb
SH
9Serge Hallyn <serge.hallyn at ubuntu.com>
10
11This library is free software; you can redistribute it and/or
12modify it under the terms of the GNU Lesser General Public
13License as published by the Free Software Foundation; either
14version 2.1 of the License, or (at your option) any later version.
15
16This library is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19Lesser General Public License for more details.
20
21You should have received a copy of the GNU Lesser General Public
22License along with this library; if not, write to the Free Software
250b1eec 23Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
810567bb
SH
24
25-->
26
7f951458 27<!DOCTYPE refentry PUBLIC @docdtd@ [
810567bb
SH
28
29<!ENTITY commonoptions SYSTEM "@builddir@/common_options.sgml">
30<!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
31]>
32
33<refentry>
34
35 <docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
36
37 <refmeta>
38 <refentrytitle>lxc-unshare</refentrytitle>
39 <manvolnum>1</manvolnum>
40 </refmeta>
41
42 <refnamediv>
43 <refname>lxc-unshare</refname>
44
45 <refpurpose>
46 Run a task in a new set of namespaces.
47 </refpurpose>
48 </refnamediv>
49
50 <refsynopsisdiv>
51 <cmdsynopsis>
1354f952 52 <command>lxc-unshare</command>
810567bb 53 <arg choice="req">-s <replaceable>namespaces</replaceable></arg>
13d8bde9 54 <arg choice="opt">-u <replaceable>user</replaceable></arg>
c1bb25a8
SR
55 <arg choice="opt">-H <replaceable>hostname</replaceable></arg>
56 <arg choice="opt">-i <replaceable>ifname</replaceable></arg>
57 <arg choice="opt">-d</arg>
58 <arg choice="opt">-M</arg>
810567bb
SH
59 <arg choice="req">command</arg>
60 </cmdsynopsis>
61 </refsynopsisdiv>
62
63 <refsect1>
64 <title>Description</title>
65
66 <para>
67 <command>lxc-unshare</command> can be used to run a task in a cloned set
68 of namespaces. This command is mainly provided for testing purposes.
69 Despite its name, it always uses clone rather than unshare to create
70 the new task with fresh namespaces. Apart from testing kernel
71 regressions this should make no difference.
72 </para>
73
74 </refsect1>
75
76 <refsect1>
77
78 <title>Options</title>
79
80 <variablelist>
81
82 <varlistentry>
83 <term>
84 <option>-s <replaceable>namespaces</replaceable></option>
85 </term>
86 <listitem>
87 <para>
88 Specify the namespaces to attach to, as a pipe-separated list,
89 e.g. <replaceable>NETWORK|IPC</replaceable>. Allowed values are
90 <replaceable>MOUNT</replaceable>, <replaceable>PID</replaceable>,
91 <replaceable>UTSNAME</replaceable>, <replaceable>IPC</replaceable>,
92 <replaceable>USER </replaceable> and
93 <replaceable>NETWORK</replaceable>. This allows one to change
94 the context of the process to e.g. the network namespace of the
95 container while retaining the other namespaces as those of the
96 host.
97 </para>
98 </listitem>
99 </varlistentry>
100
101 <varlistentry>
102 <term>
103 <option>-u <replaceable>user</replaceable></option>
104 </term>
105 <listitem>
106 <para>
13d8bde9 107 Specify a userid which the new task should become.
810567bb
SH
108 </para>
109 </listitem>
110 </varlistentry>
111
c1bb25a8
SR
112 <varlistentry>
113 <term>
114 <option>-H <replaceable>hostname</replaceable></option>
115 </term>
116 <listitem>
117 <para>
118 Set the hostname in the new container. Only allowed if
119 the UTSNAME namespace is set.
120 </para>
121 </listitem>
122 </varlistentry>
123
124 <varlistentry>
125 <term>
126 <option>-i <replaceable>interfacename</replaceable></option>
127 </term>
128 <listitem>
129 <para>
130 Move the named interface into the container. Only allowed
131 if the NETWORK namespace is set. You may specify this
132 argument multiple times to move multiple interfaces into
133 container.
134 </para>
135 </listitem>
136 </varlistentry>
137
138 <varlistentry>
139 <term>
140 <option>-d</option>
141 </term>
142 <listitem>
143 <para>
144 Daemonize (do not wait for the container to exit before exiting)
145 </para>
146 </listitem>
147 </varlistentry>
148
149 <varlistentry>
150 <term>
151 <option>-M</option>
152 </term>
153 <listitem>
154 <para>
155 Mount default filesystems (/proc /dev/shm and /dev/mqueue)
156 in the container. Only allowed if MOUNT namespace is set.
157 </para>
158 </listitem>
159 </varlistentry>
160
810567bb
SH
161 </variablelist>
162
163 </refsect1>
164
165 <refsect1>
166 <title>Examples</title>
167 <para>
168 To spawn a new shell with its own UTS (hostname) namespace,
169 <programlisting>
1354f952 170 lxc-unshare -s UTSNAME /bin/bash
810567bb
SH
171 </programlisting>
172 If the hostname is changed in that shell, the change will not be
173 reflected on the host.
174 </para>
175 <para>
176 To spawn a shell in a new network, pid, and mount namespace,
177 <programlisting>
1354f952 178 lxc-unshare -s "NETWORK|PID|MOUNT" /bin/bash
810567bb
SH
179 </programlisting>
180 The resulting shell will have pid 1 and will see no network interfaces.
181 After re-mounting /proc in that shell,
182 <programlisting>
183 mount -t proc proc /proc
184 </programlisting>
185 ps output will show there are no other processes in the namespace.
186 </para>
c1bb25a8
SR
187 <para>
188 To spawn a shell in a new network, pid, mount, and hostname
189 namespace.
190 <programlisting>
191 lxc-unshare -s "NETWORK|PID|MOUNT|UTSNAME" -M -H slave -i veth1 /bin/bash
192 </programlisting>
193
194 The resulting shell will have pid 1 and will see two network
195 interfaces (lo and veth1). The hostname will be "slave" and
196 /proc will have been remounted. ps output will show there are
197 no other processes in the namespace.
198 </para>
810567bb
SH
199 </refsect1>
200
201 &seealso;
202
203 <refsect1>
204 <title>Author</title>
205 <para>Daniel Lezcano <email>daniel.lezcano@free.fr</email></para>
206 </refsect1>
207
208</refentry>
209
210<!-- Keep this comment at the end of the file
211Local variables:
212mode: sgml
213sgml-omittag:t
214sgml-shorttag:t
215sgml-minimize-attributes:nil
216sgml-always-quote-attributes:t
217sgml-indent-step:2
218sgml-indent-data:t
219sgml-parent-document:nil
220sgml-default-dtd-file:nil
221sgml-exposed-tags:nil
222sgml-local-catalogs:nil
223sgml-local-ecat-files:nil
224End:
225-->