Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ipc: service syntax #7220

Closed
EricHripko opened this issue Feb 7, 2020 · 3 comments · Fixed by #7417
Closed

Add support for ipc: service syntax #7220

EricHripko opened this issue Feb 7, 2020 · 3 comments · Fixed by #7417

Comments

@EricHripko
Copy link

Description of the issue

docker supports --ipc flag, which according to docs:

Shared memory segments are used to accelerate inter-process communication at memory speed, rather than through pipes or through the network stack. Shared memory is commonly used by databases and custom-built (typically C/OpenMPI, C++/using boost libraries) high performance applications for scientific computing and financial services industries. If these types of applications are broken into multiple containers, you might need to share the IPC mechanisms of the containers, using "shareable" mode for the main (i.e. “donor”) container, and "container:" for other containers.

Assuming I have an application that makes use of shared memory, I can bring it up with docker run --ipc=container:name .... All good here 👍

However, if I'm using docker-compose - I am unable to get the same behaviour. This is because, according to docs, it's simply a pass-through option.

Desired Behaviour

It would be amazing if ipc option in docker-compose supported service:[service name] syntax, similar to network_mode. For example:

version: '3.7'
services:
  myrtr:
    image: myipcrouter
  mysvc:
    build:
      context: .
      dockerfile: Dockerfile
    ipc: service:myrtr

This would make the container for the target (i.e., myrtr) have --ipc=shareable and the container for the service (i.e, mysvc) have --ipc=container:<id of myrtr>.

Summary

What are your thoughts on this? I would be happy to contribute this feature if maintainers agree 🙂

@ArthurBir
Copy link

Just for the reference, pid option in docker-compose also has service:[service name] syntax, but it is not documented in Compose file version 3 reference. Documentation update Pull Request is already present here.

@ArthurBir
Copy link

@EricHripko ,

Also, not sure if this might help you out, but as an ugly, non-production workaround, try using container_name option for your shareable memory container to make container name "static":

version: '3.7'
services:
  shareable-service:
    image: "shareable_image"
    container_name: "shareable_container_name"
    ipc: "shareable"
  another-service:
    image: "another_image"
    container_name: "another_container_name"
    ipc: "container:shareable_container_name"
    depends_on:
      - "shareable-service"

@lshamis
Copy link

lshamis commented Apr 22, 2020

@ArthurBir I haven't been able to get your example to work.

I set the image names to ubuntu:bionic with command sleep 10; echo "somethinginteresting"

Creating shareable_container_name ... done
Creating another_container_name   ... error

ERROR: for another_container_name  Cannot start service another-service: can't join IPC of container e9d022cc87e93af7e06a43d8474ec32f25ffa392e93209b89ec738f94de5096a: container e9d022cc87e93af7e06a43d8474ec32f25ffa392e93209b89ec738f94de5096a is not running

ERROR: for another-service  Cannot start service another-service: can't join IPC of container e9d022cc87e93af7e06a43d8474ec32f25ffa392e93209b89ec738f94de5096a: container e9d022cc87e93af7e06a43d8474ec32f25ffa392e93209b89ec738f94de5096a is not running

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 a pull request may close this issue.

3 participants