docker-compose volume nfs

Hi !

I have this docker-compose file :

version: '2'

services:
  mopidy:
    container_name: mopidy
    build: ./mopidy
    restart: unless-stopped
    network_mode: host
    ports:
    - "8080:8080"
    volumes:
    - "music:/opt/music"
    privileged: true
    labels:
      io.balena.features.dbus: 1
    devices:
    - "/dev/snd:/dev/snd"

volumes:
  music:
    driver_opts:
      type: "nfs"
      o: "addr=192.168.100.100,nolock,soft,rw"
      device: ":/MUSIC"

The service doesn’t start when nfs volume is attached.

Any idea ?

Hi there. Just so I understand your use case exactly, do you want to give your container access to a networked drive? It may be possible to just create a script that runs on startup that connects to and mounts the drive. Let me know, thanks!

Hi,

( I will try to add a RUN task in the dockerfile with a script to test it. Not sure it will work )

I try to mount a NFS volume directly to the container like a classique volume. It is a cleaner way to do it. If not I have to install nfs-utils inside my containers.

When I made that the container seems to crash can’t find any log. Not sure the Balena Engine support the NFS volume :

Classique docker way : https://docs.docker.com/storage/volumes/#create-a-service-which-creates-an-nfs-volume
From docker-compose file : https://docs.docker.com/compose/compose-file/compose-file-v2/#volume-configuration-reference

Thank you

Hi, I found a couple of related forum threads that suggest you will need to attach your NFS mounts via a start script e.g. Mount NFS device and Defining shared NFS mount across devices?. Can you let us know if you were successful in your last message with testing a script to do this?