Skip to content

Allow IPC namespace to be shared between containers or with the host#9074

Merged
crosbymichael merged 1 commit intomoby:masterfrom
rhatdan:shm
Nov 14, 2014
Merged

Allow IPC namespace to be shared between containers or with the host#9074
crosbymichael merged 1 commit intomoby:masterfrom
rhatdan:shm

Conversation

@rhatdan
Copy link
Copy Markdown
Contributor

@rhatdan rhatdan commented Nov 10, 2014

Some workloads rely on IPC for communications with other processes. We
would like to split workloads between two container but still allow them
to communicate though shared IPC.

This patch mimics the --net code to allow --ipc=host to not split off
the IPC Namespace. ipc=container:CONTAINERID to share ipc between containers

If you share IPC between containers, then you need to make sure SELinux labels
match.

Docker-DCO-1.1-Signed-off-by: Dan Walsh dwalsh@redhat.com (github: rhatdan)

@rhatdan
Copy link
Copy Markdown
Contributor Author

rhatdan commented Nov 10, 2014

Originally #8211
And @crosbymichael had a version #8835

This takes most of the comments in from Michaels Pull. Only big one is around whether or not we should capitalize IPC or leave it Ipc.

I think there could be some more doc changes.

@sirupsen
Copy link
Copy Markdown
Contributor

Awesome. I'll try to take another look at this later today.

@rhatdan
Copy link
Copy Markdown
Contributor Author

rhatdan commented Nov 10, 2014

The build seems to have failed in a totally random place.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example with a custom C binary and what not feels kind of awkward.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well the test programs is just reading link to /proc/1/ns/ipc and making sure they are the same, which indicates you are in the same IPC namespace.

@sirupsen
Copy link
Copy Markdown
Contributor

This is starting to look great!

@SvenDowideit
Copy link
Copy Markdown
Contributor

Docs LGTM - @fredlf @jamtur01

@SvenDowideit
Copy link
Copy Markdown
Contributor

@rhatdan

--- FAIL: TestLinksNotStartedParentNotFail (0.64 seconds)
    docker_cli_links_test.go:176:  exit status 1

@rhatdan
Copy link
Copy Markdown
Contributor Author

rhatdan commented Nov 11, 2014

Yes I have no idea why? Seems to be not related to patch.

@rhatdan rhatdan force-pushed the shm branch 2 times, most recently from 3317098 to 64b18fc Compare November 11, 2014 14:07
@sirupsen
Copy link
Copy Markdown
Contributor

LGTM

@fredlf
Copy link
Copy Markdown
Contributor

fredlf commented Nov 11, 2014

LGTM. I am all for mentioning real-world applications/use-cases in the docs. As long as we are not advocating or discussing blatantly commercial/proprietary products and/or services, real-world examples are more helpful, IMHO, than abstractions.

@rhatdan
Copy link
Copy Markdown
Contributor Author

rhatdan commented Nov 11, 2014

Looks like an errant patch.

@rhatdan
Copy link
Copy Markdown
Contributor Author

rhatdan commented Nov 11, 2014

Had to add some fixes for SELinux labels.

Some workloads rely on IPC for communications with other processes.  We
would like to split workloads between two container but still allow them
to communicate though shared IPC.

This patch mimics the --net code to allow --ipc=host to not split off
the IPC Namespace.  ipc=container:CONTAINERID to share ipc between containers

If you share IPC between containers, then you need to make sure SELinux labels
match.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
@crosbymichael
Copy link
Copy Markdown
Contributor

LGTM

@fredlf
Copy link
Copy Markdown
Contributor

fredlf commented Nov 13, 2014

Oh, forgot to mention that IPC should be capitalized, as per style guide. http://docs.docker.com/contributing/docs_style-guide/#abbreviations-and-acronyms

@crosbymichael
Copy link
Copy Markdown
Contributor

ping @unclejack @jfrazelle

Please review

@jessfraz
Copy link
Copy Markdown
Contributor

LGTM

crosbymichael added a commit that referenced this pull request Nov 14, 2014
Allow IPC namespace to be shared between containers or with the host
@crosbymichael crosbymichael merged commit 07996d8 into moby:master Nov 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants