Hi all!
I have a problem with mounting remote volume via nfs
OS Version/build: macOs High Sierra 10.13.2 (17C88)
App version: Version 17.12.0-ce-rc4-mac44 (21438) Channel: edge f23de3ecc6
Steps to reproduce:
I start containers using docker-compose up -d
and my docker-compose.yml looks like this:
version: '3'
services:
### Redis
redis:
container_name: redis
image: redis:4.0-alpine
command:
- 'redis-server'
- '--loglevel ${REDIS_LOGLEVEL:-warning}'
- '--databases 2'
- '--save 300 1'
- '--save 60 1000'
- '--maxmemory ${REDIS_MAXMEM:-50mb}'
- '--maxmemory-policy ${REDIS_POLICY:-noeviction}'
- '--requirepass ${REDIS_PASS}'
volumes:
- redis:/data
ports:
- "6379:6379"
networks:
default:
ipv4_address: 172.25.0.11
### Memcached
memcached:
container_name: memcached
image: memcached:1.5-alpine
volumes:
- memcached:/var/lib/memcached
ports:
- "11211:11211"
### Dynamicus
dynamicus:
container_name: dynamicus
image: registry.gitlab.lc:5000/develop/ed/stv2-ed-sq
volumes:
- static:/var/www/static
ports:
- "8888:8888"
networks:
default:
ipv4_address: 172.25.0.12
### Volumes Setup
volumes:
memcached:
driver: "local"
redis:
driver: "local"
static:
driver: "local"
driver_opts:
type: nfs
o: "addr=192.168.0.21,rw"
device: ":/srv/static"
networks:
default:
driver: bridge
ipam:
config:
- subnet: 172.25.0.0/24
When I run docker-compose up -d
in console I see:
docker-compose up -d
Creating network "docker_default" with driver "bridge"
Creating dynamicus ... error
Creating volume "docker_memcached" with local driver
Creating volume "docker_redis" with local driver
Creating redis ...
Creating dynamicus ...
Creating redis ... done
Creating memcached ...
Creating memcached ... done
ERROR: for dynamicus Cannot start service dynamicus: error while mounting volume '/var/lib/docker/volumes/docker_static/_data': error while mounting volume with options: type='nfs' device=':/srv/static' o='addr=192.168.0.21,rw': permission denied
ERROR: Encountered errors while bringing up the project.
When I add option vers=4
in docker-compose.yml like this:
volumes:
static:
driver: "local"
driver_opts:
type: nfs
o: "addr=192.168.0.21,vers=4,rw"
device: ":/srv/static"
I got another error message:
docker-compose up -d
Creating network "docker_default" with driver "bridge"
Creating volume "docker_static" with local driver
Creating volume "docker_memcached" with local driver
Creating volume "docker_redis" with local driver
Creating redis ... done
Creating dynamicus ...
Creating dynamicus ... error
Creating memcached ...
ERROR: for dynamicus Cannot start service dynamicus: error while mounting volume '/var/lib/docker/volumes/docker_static/_data': error while mounting volume with options: type='nfs' device=':/srv/static' o='addr=192.168.0.21,vers=4,rw': operation not permitted
ERROR: Encountered errors while bringing up the project.
On my nfs-server (192.168.0.21) in /etc/exports write this line:
/srv/static *(rw,sync,no_subtree_check)
Nfs-server is accessible from my mac:
$ showmount -e 192.168.0.21
Exports list on 192.168.0.21:
/srv/static *
In /etc/nfs.conf on my mac I have this:
$ cat /etc/nfs.conf
#
# nfs.conf: the NFS configuration file
#
nfs.server.mount.require_resv_port = 0
I can mount nfs resource to my maŃ using command:
sudo mount -t nfs -o resvport,rw 192.168.0.21:/srv/static /private/srv/static
Adding option resvport
to my docker-compose.yml didnāt help:
volumes:
static:
driver: "local"
driver_opts:
type: nfs
o: "addr=192.168.0.21,resvport,vers=4,rw"
device: ":/srv/static"
In console:
docker-compose up -d
Creating network "docker_default" with driver "bridge"
Creating volume "docker_static" with local driver
Creating volume "docker_memcached" with local driver
Creating volume "docker_redis" with local driver
Creating dynamicus ... error
Creating redis ... done
Creating redis ...
ERROR: for dynamicus Cannot start service dynamicus: error while mounting volume '/var/lib/docker/volumes/docker_static/_data': error while mounting volume with options: type='nfs' device=':/srv/static' o='addr=192.168.0.21,resvport,vers=4,rw': operation not permitted
ERROR: Encountered errors while bringing up the project.
Can anybody help with this?