Mounting Docker Container Folder to NAS Shared Folder[Windows]

Here’s what I do. I believe it’s still not possible to provide the path to a credentials file instead of explicitly passing username and password with Docker volumes:

version: '3.7'

volumes:
  myfileshare:
    driver_opts:
      type: cifs
      o: "user=myfileshare-username,password=myfileshare-password,file_mode=0777,dir_mode=0777,iocharset=utf8,vers=3.1.1,rw,uid=1000,gid=1000,sec=ntlmssp"
      device: //192.168.178.20/myfileshare

services:
  app:
    image: someimage:latest
    restart: unless-stopped
    ports:
      - "8080:8000"
    volumes:
      - myfileshare:/srv/myfileshare

Was this helpful?

0 / 0