Mounting a single file using cifs

What a wonderful community - I am new to docker and greatly appreciate the help provided by so many here.

I am new to containers and docker but have made reasonable progress in firing up mariadb and keycloak as services running in their containers. I have configured users etc in keycloak.

I am now looking to install a specific theme in keycloak and have run into a simple requirement: provide a single file in the keycloak container, with its uid and gid set to those used in the container (and that do not exist on the host). The host is fairly vanilla linux: basically what runs on my Synology NAS (Linux myserver 4.4.302+ #69057 SMP Fri Jan 12 17:01:14 CST 2024 x86_64 GNU/Linux synology_r1000_723+)

I googled and found this excellent thread: Docker compose: mount samba volume

I intend to try as suggested in that thread in my docker compose file but wanted to ask three additional questions:

  1. Is it possible to mount a single file using samba?
  2. Does that file have to pre-exist in the container?
  3. I wanted to clarify that the solution as suggested in the above reference allows the uid and gid to be set to those used in the container?

I would greatly appreciate any guidance.

  1. A volume is a folder. Even if it could be a file, If Samba doesn’t support mounting a file, Docker will not change it. Bind mount can mount a single file which is unfortunately set under the same “volumes” section in a compose file. For bind mounting, you need to mount the network filesystem on the host and bind mount from that.
  2. No, but as I wrote, you can use only bind mount to mount a single file.
  3. cifs can’t keep Linux user IDs, so if you bind mount, all the files will be owned by the user with which you mounted the filesystem on the host. If you want to handle user IDs, you need something like NFS.
1 Like

Many thanks for your response - I am very grateful!

Best regards