You could mount the network share on the host/Ubuntu and then reference it in your docker compose file. It works. I prefer to write the mount in the Docker compose file since it’s a bit more portable. Something like this depending on if you’re using SMB/CIFS or NFS:
The ${user} and ${pass} in the smb volume definition are variables that you’ll need to have in a .env file next to your compose.yaml file. The .env file is just a normal text file with each line setting a value to a variable. Like:
user=my_username
pass=123_abc_!@#
Then you restrict the permissions of your .env file and you can essentially take a backup of both files and use them on any server with Docker.
You could mount the network share on the host/Ubuntu and then reference it in your docker compose file. It works. I prefer to write the mount in the Docker compose file since it’s a bit more portable. Something like this depending on if you’re using SMB/CIFS or NFS:
services: some_music_app: image: music_app_image:latest container_name: music_app volumes: - smb:/some/path/smb/music - nfs:/some/path/nfs/music volumes: smb: driver_opts: type: cifs o: "username=${user},password=${pass},uid=1000,gid=1000,vers=3.0" device: "//tiger-nas/music/music" nfs: driver: local driver_opts: type: nfs o: addr=tiger-nas,nolock,soft,rw,nfsvers=4 device: ":path/to/music/music"The ${user} and ${pass} in the smb volume definition are variables that you’ll need to have in a .env file next to your compose.yaml file. The .env file is just a normal text file with each line setting a value to a variable. Like:
user=my_username pass=123_abc_!@#Then you restrict the permissions of your .env file and you can essentially take a backup of both files and use them on any server with Docker.