EDIT: As stated in comments, solution can be found here
Using docker-compose I need to define a shared volume between 2 containers and host. In the example below, files shared between cont0 and cont1 need to be shared also with host.
Is it even possible what I'm trying to do? (The idea is that cont1 (and cont2) generate files that must be shared with cont0, but I want to easily access them from host).
This is the relevant part of a docker compose sharing volume C1 between cont0 and cont1, volume C2 between cont0 and cont2 and folder d of cont0 with host (folder D):
volumes:
C1:
C2
services:
cont0:
volumes:
- ./D:/app/d
- C1:/app/c1
- C1:/app/c2
cont1:
volumes:
- C1:/app/c
cont2:
volumes:
- C2:/app/c
I now want to have folder E of host to hold data as folder c of cont0 and cont1 (or cont0 and cont2). I tried this:
cont1:
volumes:
- ./E/c1:/app/c
- C1:/app/c
cont2:
volumes:
- ./E/c2:/app/c
- C2:/app/c
but it failed to create the volume on the container definition (didn't even showed it on the docker-compose .... config
I then tried to do it from cont0 as:
cont0:
volumes:
- ./D:/app/d
- C1:/app/c1
- C1:/app/c2
- ./E/c1:/app/c1
- ./E/c2:/app/c2
but it failed as well.