ehough / docker-nfs-server

A lightweight, robust, flexible, and containerized NFS server.
https://hub.docker.com/r/erichough/nfs-server/
GNU General Public License v3.0
669 stars 221 forks source link

problem on mounting shared volume #54

Open OkenKhuman opened 3 years ago

OkenKhuman commented 3 years ago

I'm trying to mount a network shared directory for shareing html files and certificates. I'm using the below setup

version: '3.8'
services:
    nfs:
        image: erichough/nfs-server
        restart: unless-stopped
        environment:
            - NFS_EXPORT_0='/share/data0                  *(rw,no_subtree_check)'
            - NFS_EXPORT_1='/share/data1                  *(rw,no_subtree_check)'
        volumes:
            - ./html1:/share/data1
            - /certs/etc/letsencrypt/live:/share/data0
    proxy:
        image: nginx
        restart: unless-stopped
        depends_on:
            - nfs
        ports:
          - '80:80'
          - '443:443'
        volumes:
           - ./conf_data/proxy_template:/etc/nginx_templates
           - share1:/www/data1
           - share0:/etc/letsencrypt/live
    web_1:
        image: httpd
        restart: unless-stopped
        depends_on:
            - proxy
        volumes:
            - ./conf_data/mqtt_conf/mosquitto.conf:/mosquitto/config/mosquitto.conf
            - ./conf_data/mqtt_conf/more/:/mosquitto/config/more/
volumes:
    share0:
        type: "nfs"
        o: "addr=nfs,nolock,soft,rw"
        device: ":/share/data0"
    share1:
        type: "nfs"
        o: "addr=nfs,nolock,soft,rw"
        device: ":/share/data1"

but when I try to run using docker-compose up it gave me error as

ERROR: The Compose file './docker-compose.yml' is invalid because:
volumes.share0 value 'device', 'o', 'type' do not match any of the regexes: '^x-'
volumes.share1 value 'device', 'o', 'type' do not match any of the regexes: '^x-'

what can be the volume setup to mount the nfs shared?

please provide an example to mount the volume in compose setup

jjwong0915 commented 3 years ago

@OkenKhuman Your docker-compose.yml seems having incorrect syntax. Please refer the driver_opts section in docker-compose file reference. (link: https://docs.docker.com/compose/compose-file/#driver_opts)

garanews commented 3 years ago

I tried docker-compose provided here, adding the "driver_opts:" directive but having this issue:

Creating ehough_nfs_1 ... done
Creating ehough_proxy_1 ... error

ERROR: for ehough_proxy_1  Cannot create container for service proxy: error resolving passed in network volume address: lookup nfs on 127.0.0.53:53: read udp 127.0.0.1:38094->127.0.0.53:53: i/o timeout

ERROR: for proxy  Cannot create container for service proxy: error resolving passed in network volume address: lookup nfs on 127.0.0.53:53: read udp 127.0.0.1:38094->127.0.0.53:53: i/o timeout
ERROR: Encountered errors while bringing up the project.
garanews commented 3 years ago

@ehough any idea about this error?