简体   繁体   English

Docker / Docker-Compose中的NFS卷

[英]NFS Volumes in Docker/Docker-Compose

I'm using boot2mac and docker-compose. 我正在使用boot2mac和docker-compose。 I want to be able to configure this to mount my volume via NFS. 我希望能够通过NFS配置它来挂载我的卷。 This is my configuration: 这是我的配置:

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

To define an nfs volume in a compose file do as described in this thread : 要在撰写文件中定义nfs卷,请按照此主题中的描述进行操作:

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 至少从composefile版本2开始支持此功能

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM