Merging host and container volume contents in docker

5.9k Views Asked by At

I have a project with a docker image whose volume contains contents on start up. Are there any methods to MERGE the contents of both host and container on the volume yet keep the host contents persistent over in the container?

this is my compose.yml

services:
  db:
    image: mysql
    environment:
      MYSQL_DATABASE: ninja
      MYSQL_ROOT_PASSWORD: pwd
  app:
    image: invoiceninja/invoiceninja
    volumes:
      - ./install-wipay.sh:/install-wipay.sh
      - ./composer.json:/var/www/app/composer.json
      # would like to merge and persist this volume
      - ~/Documents/Git/heroku/invoiceninja/app/:/var/www/app
      - ~/Documents/Git/omnipay-wipay/:/var/repo/omnipay-wipay/:ro
      - ./.env:/var/www/app/.env:ro
      - ./storage:/var/www/app/docker-backup-storage:rw
      - ./logo:/var/www/app/docker-backup-public/logo/
    links:
      - db:mysql
    env_file: .env
  web:
    image: nginx
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
0

There are 0 best solutions below