Allow IPC namespace to be shared between containers or with the host#8211
Allow IPC namespace to be shared between containers or with the host#8211rhatdan wants to merge 1 commit intomoby:masterfrom
Conversation
|
I realize that this pull request needs to be split to contribute to libcontainer separately. But I wanted to get an overall feel for the patch before I submit changes to libcontainer. |
|
+1 from me |
|
Thanks @rhatdan, I will test and report back. |
|
@rhatdan Could we something in the run docs just saying why you might do this? Or perhaps even a simple example? |
|
+1 from me.
|
|
@jeremyeder Could you give an example, since you were the trigger for this code. |
|
One problem I will have with this patch is that SELinux will not allow it. I might have to change the code to say ipc=container:CONTAINERID implies that the SELinux labels of the new container has to match the label of CONTAINERID. Also ipc=host would most likely require --security label:disabled. (But that is another patch that has not been merged) :^( |
|
Shared memory segments are used to accelerate inter-process communication at memory speed, rather than, say, through pipes or through the network stack. Shared memory is a commonly used technique used in applications such as databases and their worker threads, along with a large population of custom-built (typically C/OpenMPI, C++/using boost libraries) high performance applications that you will find in the scientific computing and financial services industries. Without the ability to share memory between containers, this class of high-performance workloads will not be candidates for containerization. To Dan's point about security; processes that share memory are explicitly designed to cooperate, and thus should be grouped together from a security/isolation perspective at least as far as memory. |
|
@jamtur01 Is @jeremyeder Message above enough to add? |
|
@jamtur01 when I complete testing of this I will share the example/walkthrough. Please give me a day or 2. |
docs/sources/reference/run.md
Outdated
There was a problem hiding this comment.
Possessive: container's IPC stack.
|
+1 to adding a thoroughly explained example. Thanks. |
|
|
@fredlf Is this what you were thinking? |
|
Yes, that's terrific. Examples help users so much. Thank you. |
|
+1 to example :) |
|
Example LGTM - add away to run.md. |
daemon/container.go
Outdated
There was a problem hiding this comment.
I reckon this should be "Invalid IPC ..".
|
+1; much desired. The code looks good at a glance. |
|
Can you please open a PR on libcontainer for those changes? |
|
FYI. If we want this in my 1.3 we should have it merged by first of next week. I would like it in if we finish all the changes. |
|
FWIW Go conventions say not to capitalize error messages.
|
|
https://code.google.com/p/go-wiki/wiki/CodeReviewComments#Error_Strings - not sure how far we've adopted those conventions though. |
|
It is a very minor point in the grand scheme of things :)
|
|
@ostezer I just copied these from the error messages for --net, so if we decide to capitilize I would probably change --network stuff also. |
|
@rhatdan easy :) not in this PR - and we can leave it for the techwriter review of strings :) mostly we need core review now. |
|
Thanks @rhatdan ;-) |
2fe6751 to
92ab266
Compare
|
Since this is not going to make it into the docker-1.3 pull, I completed the SELinux support. If you run a container with --ipc=host, this means you could share IPC information with any process on the host OS, so I disable SELinux label enforcement. If you run a container with --ipc=container:ID we have to run the new container process with the same SELinux labels as the container you are sharing IPC with, or SELinux will block the interaction. |
6b52df8 to
2f4a770
Compare
docs/sources/reference/run.md
Outdated
|
Docs LGTM once the missing word is added. |
|
Docs are good to go, waiting on Core reviews :) @crosbymichael @tiborvass :) |
e12b084 to
a77b917
Compare
|
Added tests to verify --ipc=host and --ipc=container:ID works properly. |
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)
|
Closing in favor of #8835 |
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
Docker-DCO-1.1-Signed-off-by: Dan Walsh dwalsh@redhat.com (github: rhatdan)