docker-compose volume nfs

Hi !

I have this docker-compose file :

version: '2'

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

      type: "nfs"
      o: "addr=,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!


( 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 :
From docker-compose file :

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?