How to access a mounted network folder using compose?

Good day,

I am relatively new to docker and am looking for assistance, i was hoping someone could point me in the right direction.

I have docker desktop for mac up and running and my app was pulled and setup using docker compose. What I’m looking to do is access a folder on my NAS to store files from the app I am running.

Is it as simple as figuring out the path of the NAS folder that is mounted in OSX already and putting that path into the compose script? Or do I need to do more with docker to make this happen? I have done some googling but I’m not exactly sure on what I might be looking for and have come up empty.

Thanks for any assistance you can provide.

macOS Sequoia 15.2
Docker Desktop Mac
Portainer

You should be able to mount the local folder from Mac, which is mounted from a NAS. This has the advantage that you only have one network mount to NAS, even if multiple services use the folder.

Awesome! I have more questions if you wouldn’t mind helping me out.

If this is the current path for my storage in my docker compose

  • /Users/macmini/frigate/media:/media

And my NAS folder has a user name and password, but I have mounted it in OSX already and it shows on my desktop how do I add it to my docker compose path? The server folder is located at

smb://192.168.1.150/frigate

Have you considered using named volumes instead? I prefer it always over os mounts.

You can configure named volumes to smb/cifs shares like in this post:

If this is not what you want, you will need to wait for someone who actually uses Docker Desktop on Mac, and can tell you about how to map host folders into the Docker Desktop utility vm.

Thanks for your reply! Im willing to try anything, I just don’t know how this would be implemented. Im newish to docker and yaml. I can post my compose file here and maybe you could tell me how to add your code? Or how is this implemented?

Thanks for the assistance and suggestions

version: "3.9"
services:
  frigate:
    container_name: frigate0150rc2
    privileged: true
    restart: unless-stopped
    image: ghcr.io/blakeblackshear/frigate:0.15.0-rc2-standard-arm64
    shm_size: "6gb"
    volumes:
      - /etc/localtime:/etc/localtime:ca
      - /Users/macmini/frigate/config:/config
      - /Users/macmini/frigate/media:/media
      - type: tmpfs # 1GB of memory
        target: /tmp/cache
        tmpfs:
          size: 1000000000
    ports:
      - "5000:5000" # Port used by the Web UI
      - "8554:8554" # RTSP feeds
      - "8555:8555/tcp" # WebRTC over tcp
      - "8555:8555/udp" # WebRTC over udp
    environment:
      FRIGATE_RTSP_PASSWORD: "##########"

Sorry I thought I replied to your post. I just read the thread you linked to. Would it be as simple as editing my compose file as follows?

I tried to edit my compose file but I get an error, do you happen to see what I did wrong?

It should look something like this:

services:
  frigate:
    container_name: frigate0150rc2
    privileged: true
    restart: unless-stopped
    image: ghcr.io/blakeblackshear/frigate:0.15.0-rc2-standard-arm64
    shm_size: "6gb"
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - type: volume
        source: frigate
        target: /config
        volume:
          subpath: config 
      - type: volume
        source: frigate
        target: /media
        volume:
          subpath: media
      - type: tmpfs # 1GB of memory
        target: /tmp/cache
        tmpfs:
          size: 1000000000
    ports:
      - "5000:5000" # Port used by the Web UI
      - "8554:8554" # RTSP feeds
      - "8555:8555/tcp" # WebRTC over tcp
      - "8555:8555/udp" # WebRTC over udp
    environment:
      FRIGATE_RTSP_PASSWORD: "##########"

volumes: 
  frigate:
    driver_opts:
      type: cifs 
      o: username=macmini,password=yourpassword,uid=1021,gid=100,vers=3.0
      device: //192.168.1.150/frigate

Make sure the uid and gid in the volume declaration match the actuall ids used on your NAS remote share.

2 Likes

Thank you so much for your assistance, I really appreciate it. I used ssh to login to my Synology NAS and find my uid and gid, I also found the path to the shared folder is
macmini@SynologyNAS:/volume1/frigate$
so I updated the path to
device: //192.168.1.150/volume1/frigate
but also tried
device: //192.168.1.150/frigate

mounted the folder on the Mac and its just logs in and mounts at the frigate folder

But I am having errors when the container starts, it won’t fully start and I am wondering if you happen to know what these errors mean? Address 192.168.1.113 is the address to my Mac mini that is running docker and Portainer. 192.168.1.113:5000 is the address to the web gui for the container.

Im not sure where 192.168.65.1 address is coming from below, but I believe its part of docker desktop

2025-02-06 18:29:07.867215509 2025/02/06 18:29:07 [error] 165#165: *4 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: , request: “GET /api/version HTTP/1.1”, subrequest: “/auth”, upstream: “http://127.0.0.1:5001/auth”, host: “127.0.0.1:5000”
2025-02-06 18:29:07.867220884 2025/02/06 18:29:07 [error] 165#165: *4 auth request unexpected status: 502 while sending to client, client: 127.0.0.1, server: , request: “GET /api/version HTTP/1.1”, host: “127.0.0.1:5000”
2025-02-06 18:29:09.859242635 2025/02/06 18:29:09 [error] 162#162: *6 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.65.1, server: , request: “GET /api/stats HTTP/1.1”, subrequest: “/auth”, upstream: “http://127.0.0.1:5001/auth”, host: “192.168.1.113:5000”
2025-02-06 18:29:09.859251719 2025/02/06 18:29:09 [error] 162#162: *6 auth request unexpected status: 502 while sending to client, client: 192.168.65.1, server: , request: “GET /api/stats HTTP/1.1”, host: “192.168.1.113:5000”

Good morning,

I have googled and fought with this for most of the evening yesterday. Hopefully you have some insight as to what the problem might be. I even tried to add the mounted path to shared folders in docker desktop but it won’t save the share.

Also is there a way I can send you some money for assistance?

Thanks again and I appreciate the help.

On a Synology NAS the cifs shares are //<nas ip or hostnam>/<name of the share>. The path (including /volume1) is only relevant with nfs shares.

It is most likely the ip of the docker desktop utility vm.

Looks like your application is not configured correct. I have no idea what frigate is or how to configure it.

This is a voluntary community forum. People respond here because they want to help others.

If it’s about karma points: next time when you see a person in need, asking for a little change, just help them out. :):

Make sure to align the uid:gid of the process inside the container, with the uid:gid of the cifs share you use as volume on the container. It depends on the image how this needs to be done.

2 Likes

I found the repo https://github.com/blakeblackshear/frigateand checked the Dockerfile in it.

It looks like the container starts as root (which seems to be required), so aligning the uid:gid of the container process and your remote share won’t be possible. I am not entirely sure that it cause a problem, or not.

You should check the GitHub’s repos issue if an issue matching your problem already exists. If not you might want to create one.

1 Like

Since I wasn’t sure, I tested it:

  • if the process inside the container is executed as root: it works like a charm. File written on the remote share are owned by the uid and gid used in the driver_opts’s o value.
  • if the process inside the container is executed as non-root: the uid and/or uid must align with the uid and gid used in the driver_opts’s o value in order to be permitted to write into the remote share.

The first bullet point applies to your situation.

Thank you very much for looking into this further, you really didn’t have to but I do really appreciate it. I will give it another try today when I have a chance.