Docker Community Forums

Share and learn in the Docker community.

Create one volume per container


(Binero) #1

Hear me out.

I have a docker-compose.yml. In that file I define a service. The service will end up spawning sibling dockers. It needs to share a directory with these siblings, and it needs to limit how big this directory can contain. Every instance of my service will only have one sibling, which it’ll kill and re-spawn repeatedly.

To get the docker to spawn siblings, I have mounted the docker socket in it, as seems to be common practise for this edge case.

The sharing of directories between the docker and its sibling is not straight forward though. How do I share a volume between a docker and its spawned sibling?

I need to be able to limit such volume in size, and it must be unique for every instance of the service. If the service has two instances, every instance needs their own volume that it can share with its sibling.

Any suggestions? Thanks in advance!