problem on mounting shared volume
OkenKhuman opened this issue · 3 comments
OkenKhuman commented
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
@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
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.