Search code examples
dockernfsboot2dockerdocker-compose

NFS Volumes in Docker/Docker-Compose


I'm using boot2mac and docker-compose. I want to be able to configure this to mount my volume via NFS. This is my configuration:

web:
  image: nginx
  links:
    - db
  ports:
    - "80:80"
  volumes:
    - .:/usr/share/nginx/html
db:
    image: postgres

Solution

  • To define an nfs volume in a compose file do as described in this thread:

    volumes:
      name:
        driver: local
        driver_opts:
          type: nfs
          o: addr=192.168.1.1,rw
          device: ":/path/to/dir"
    

    This is supported since at least composefile version 2