Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
46186acd
Unverified
Commit
46186acd
authored
Feb 05, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc: add lxc.namespace.clone + lxc.namespace.keep
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
8bc8c715
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
3 deletions
+62
-3
lxc.container.conf.sgml.in
doc/lxc.container.conf.sgml.in
+61
-2
start.c
src/lxc/start.c
+1
-1
No files found.
doc/lxc.container.conf.sgml.in
View file @
46186acd
...
@@ -1426,13 +1426,72 @@ dev/null proc/kcore none bind,relative 0 0
...
@@ -1426,13 +1426,72 @@ dev/null proc/kcore none bind,relative 0 0
</refsect2>
</refsect2>
<refsect2>
<refsect2>
<title>Namespace
Inheritance
</title>
<title>Namespace
s
</title>
<para>
<para>
A namespace can be inherited from another container or process.
A namespace can be cloned (<option>lxc.namespace.clone</option>),
kept (<option>lxc.namespace.keep</option>) or shared
(<option>lxc.namespace.share.[namespace identifier]</option>).
</para>
</para>
<variablelist>
<variablelist>
<varlistentry>
<varlistentry>
<term>
<term>
<option>lxc.namespace.clone</option>
</term>
<listitem>
<para>
Specify namespaces which the container is supposed to be created
with. The namespaces to create are specified as a space separated
list. Each namespace must correspond to one of the standard
namespace identifiers as seen in the
<filename>/proc/PID/ns</filename> directory.
When <option>lxc.namespace.clone</option> is not explicitly set all
namespaces supported by the kernel and the current configuration
will be used.
</para>
<para>
To create a new mount, net and ipc namespace set
<option>lxc.namespace.clone=mount net ipc</option>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>lxc.namespace.keep</option>
</term>
<listitem>
<para>
Specify namespaces which the container is supposed to inherit from
the process that created it. The namespaces to keep are specified as
a space separated list. Each namespace must correspond to one of the
standard namespace identifiers as seen in the
<filename>/proc/PID/ns</filename> directory.
The <option>lxc.namespace.keep</option> is a
blacklist option, i.e. it is useful when enforcing that containers
must keep a specific set of namespaces.
</para>
<para>
To keep the network, user and ipc namespace set
<option>lxc.namespace.keep=user net ipc</option>.
</para>
<para>
Note that sharing pid namespaces will likely not work with most init
systems.
</para>
<para>
Note that if the container requests a new user namespace and the
container wants to inherit the network namespace it needs to inherit
the user namespace as well.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>lxc.namespace.share.[namespace identifier]</option>
<option>lxc.namespace.share.[namespace identifier]</option>
</term>
</term>
<listitem>
<listitem>
...
...
src/lxc/start.c
View file @
46186acd
...
@@ -1555,7 +1555,7 @@ static int lxc_spawn(struct lxc_handler *handler)
...
@@ -1555,7 +1555,7 @@ static int lxc_spawn(struct lxc_handler *handler)
*/
*/
if
(
wants_to_map_ids
)
{
if
(
wants_to_map_ids
)
{
if
(
!
handler
->
conf
->
ns_share
[
LXC_NS_USER
]
||
if
(
!
handler
->
conf
->
ns_share
[
LXC_NS_USER
]
||
(
handler
->
conf
->
ns_keep
&
CLONE_NEWUSER
)
>
0
)
{
(
handler
->
conf
->
ns_keep
&
CLONE_NEWUSER
)
==
0
)
{
ret
=
lxc_map_ids
(
id_map
,
handler
->
pid
);
ret
=
lxc_map_ids
(
id_map
,
handler
->
pid
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
ERROR
(
"Failed to set up id mapping."
);
ERROR
(
"Failed to set up id mapping."
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment