Docker Community Forums

Share and learn in the Docker community.

Shared volume between muliple docker-compose


(Halindel) #1

Hello,

I am sorry in advance if this is already solve or other but I search for one week and didn’t find a solution.
I have multiple project with different docker compose and I would like to have a volume that is shared between them like an nfs volume. Each docker-compose is separat and I want the data to be writer and read by all of them like the volume :

version: "2"
services:
  nginx:
      build:
          context: ./docker/nginx
      volumes:
          - ./:/var/app
          - ./docker/sock:/sock
      volumes_from:
          - haproxy_haproxy_1:/var/app/dev
      networks:
          haproxy_static-network:
            ipv4_address: 172.20.1.1
      env_file:
        - .env
  php:
      build:
          context: ./docker/php
      volumes:
          - ./docker/sock:/sock
          - ./:/var/app
      volumes_from:
          - haproxy_haproxy_1:/var/app/dev        
      tty: true
      networks:
          haproxy_static-network:
            ipv4_address: 172.20.3.1
      env_file:
        - .env
networks:
  haproxy_static-network:
    external: true
#  supervisord:
#      build:
#          context: ./supervisord
#      volumes:
#          - ./app:/var/app

35

So can we setup this without the need for the host to have some upgrade or software install because I want to have my process work on different system without having to change.

I try to having an NFS docker and shared from him but I find that the host need to allow the nfs and I ask if we must allow that or can we use and other method.

Thanks in advance hope it’s clear.
Regards