Create two-way shares between Docker host and container

If you are using Docker volumes to copy files over to a container and would like to have two-way sharing (i.e., container changes to reflect on host folder), here's the docker-compose syntax to be used:

volumes:  
  shared:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: "/home/alexnj/projects/test/shared"

services:  
  web:
    build: .
    command: npm run start
    volumes:
      - shared:/app/shared
comments powered by Disqus