I am trying to mount an NFS share inside a docker container. I am using docker compose and my compose file is as follows:
version: "3.2"
volumes:
movies:
driver: local
driver_opts:
type: nfs
o: addr=mediaserver,nfsvers=4,nolock,soft,rw
device: :/media/movies
services:
radarr:
image: lscr.io/linuxserver/radarr:latest
container_name: radarr
environment:
- PUID=1000
- PGID=1000
- TZ=America/Toronto
volumes:
- /home/tom/docker/configs/radarr:/config
- movies:/movies
restart: unless-stopped
networks:
- medianet
ports:
- 7878:7878
When I run docker compose, I get an error stating:
Error response from daemon: error while mounting volume '/var/lib/docker/volumes/docker_movies/_data': failed to mount local volume: mount :/media/movies:/var/lib/docker/volumes/docker_movies/_data, data: addr=192.168.0.62,nfsvers=4,nolock,soft: no such file or directory
Now my first thought was I had entered the path incorrectly, but If I try this on the docker host it mounts fine and I can see the files inside the mount.
This is the command I use to mount it directly on the host:
sudo mount -t nfs mediaserver:/media/movies /home/tom/testmoviemount
I feel like I must be doing something wrong, I just can’t seem to find what as I am so new. Hope someone has some ideas.