Skip to content

Allow PID namespace to be shared between container - #13453

Closed
hqhq wants to merge 1 commit into
moby:masterfrom
hqhq:hq_add_pidns_share
Closed

hqhq wants to merge 1 commit into
moby:masterfrom
hqhq:hq_add_pidns_share

Conversation

@hqhq

@hqhq hqhq commented May 25, 2015

Copy link
Copy Markdown
Contributor

Closes: #10163

Share PID namespace with host is already supported, we can use
debug tools like strace in container on pids in host, it will be
cool if we can strace in container on pids in another container.

Signed-off-by: Qiang Huang [email protected]

Closes: moby#10163

Share PID namespace with host is already supported, we can use
debug tools like strace in container on pids in host, it will be
cool if we can strace in container on pids in another container.

Signed-off-by: Qiang Huang <[email protected]>
@hqhq

hqhq commented May 25, 2015

Copy link
Copy Markdown
Contributor Author

Well, test failed, figured pid namespace would be a bit complicated for this.

After my patch, we can share pid namespace with other containers, but not for the first process of the container, because setns to pid namespace will only effect the child processes. So in my test case,

cmd = exec.Command(dockerBinary, "run", fmt.Sprintf("--pid=container:%s", id), "busybox", "readlink", "/proc/self/ns/pid")

readlink command is the first process in the container and it's pid namespace is outside.

I think we have two ways to fix this:

  • fork process in joinExistingNamespaces
  • expand nsexec.c and use it at running time in the case of --pid=container:xxx

Both of them are not easy to do, think I need some help here. @crosbymichael @LK4D4 @rhatdan

@icecrime

Copy link
Copy Markdown
Contributor

Collective review with @crosbymichael @jfrazelle @calavera

We're +1 on design, however we think you're gonna have to go with the second solution (i.e., use nsexec.c to do all setns related operations, joinExistingNamespaces should be removed). Considering that the PR is far from ready, I hope you'll understand that we're closing this until it's ready for review. Feel free to ping us on IRC for any help and to open a new PR when it's ready.

@hqhq

hqhq commented Jun 18, 2015

Copy link
Copy Markdown
Contributor Author

@icecrime This feature lacks of libcontainer support, docker-archive/libcontainer#609 is working on libcontainer part, when that one is merged, this PR just needs a rebase, I'll do that and ask for reopen by then, thanks.

@estesp

estesp commented Mar 4, 2016

Copy link
Copy Markdown
Contributor

I believe once #20956 is merged this can be rebased and work can continue on shared PID namespaces.

@estesp estesp reopened this Mar 4, 2016
@calavera

calavera commented Mar 4, 2016

Copy link
Copy Markdown
Contributor

@estesp let's open it again when #20956 is merged 😉

@calavera calavera closed this Mar 4, 2016
@hqhq

hqhq commented Mar 5, 2016

Copy link
Copy Markdown
Contributor Author

Yeah, once it's reopen, I'll rework it.

@estesp

estesp commented Mar 5, 2016

Copy link
Copy Markdown
Contributor

@calavera - I meant to leave it closed but the "Reopen and comment" button I had never used before looked so interesting :) Thanks for cleaning up--agreed :)

@hqhq
hqhq deleted the hq_add_pidns_share branch July 15, 2016 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow shared PID namespaces

5 participants