0

I've been banging my head against the wall trying to sort out permissions issues when running a container that uses a remote SMB share for storing configuration files.

I found this post and answer but still can't seem to get things to work:

docker-add-network-drive-as-volume-on-windows

For the below YAML code, yes everything is formatted correctly. I just copied this from my reddit post and the indents are not showing correctly now.

My set-up is as follows:

Running Proxmox as my hypervisor with:

TrueNAS Scale as the NAS

Debian VM for hosting Docker

The TrueNAS VM has a single pool, with 1 dataset for SMB shares and 1 dataset for NFS shares (implemented for troubleshooting purposes)

I have credentials steve:steve (1000:1000) supersecurepassword with Full Control ACL permissions on the SMB share. I can access this share via windows and CLI and have all expected operations behaving as expected.

On the Debian host, I have created user steve:steve (1000:1000) with supersecurepassword.

I have been able to successfully mount and map the share within the debian host using cifs using:

//192.168.10.206/dockerdata /mnt/dockershare cifsuid=1000,gid=1000,vers=3.0,credentials=/root/.truenascreds 0 0

The credentials are:

username=steve
password=supersecurepassword

I can read/write from CLI through the mount point, view files, modify files, etc.

I have also successfully mounted & read/write the share with these additional options:

file_mode=0777,dir_mode=0777,noexec,nosuid,nosetuids,nodev

Now here's where I start having problems. I can create a container user docker compose, portainer (manual creation and stack for compose) but run into database errors as the container attempts to start.

version: "2.1"

services:

babybuddytestsmbmount:

image: lscr.io/linuxserver/babybuddy:latest

container_name: babybuddytestsmbmount

environment:

- PUID=1000

- PGID=1000

- TZ=America/New_York

- CSRF_TRUSTED_ORIGINS=http://127.0.0.1:8000,https://babybuddy.domain.com

ports:

- 1801:8000

restart: unless-stopped

volumes:

- /mnt/dockershare/babybuddy2:/config

Docker will create all folders and files, start the container but the webui will return a server 500 error. The logs indicate these database errors which results in a large number of exceptions:

sqlite3.OperationalError: database is locked

django.db.utils.OperationalError: database is locked

django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table (database is locked)

I also tried mounting the SMB share in a docker volume using the following:

version: "2.1"

services:

babybuddy:

image: lscr.io/linuxserver/babybuddy:latest

container_name: babybuddy

environment:

- PUID=1000

- PGID=1000

- TZ=America/New_York

- CSRF_TRUSTED_ORIGINS=http://127.0.0.1:8000,https://babybuddy.domain.com

ports:

- 1800:8000

restart: unless-stopped

volumes:

- dockerdata:/config

volumes:

dockerdata:

driver_opts:

type: "cifs"

o: "username=steve,password=supersecurepassword,uid=1000,gid=1000,file_mode=0777,dir_mode=0777,noexec,nosuid,nosetuids,nodev,vers=3.0"

device: "//192.168.10.206/dockerdata"

I have also tried this under options:

o: "username=steve,password=supersecurepassword,uid=1000,gid=1000,rw,vers=3.0"

Docker again is able to create the container, create & mount the volume, create all folders and files, but encouters the same DB errors indicated above.

I believe this is because the container is trying to access the SMB share as root, which TrueNAS does not permit. I have verified that all files and folders are under the correct ownership, and during troubleshooting have also stopped the container, recursively chown and chgrp the dataset to root:root, restarting the container and no dice. Changing the SMB credntials on the debian host to root results in a failure to connect.

Testing to ensure I didn't have a different issue causing problems, I was able to sucessfully start the container locally on the host as well as using a remote NFS share from the same TrueNAS VM.

I have also played with the dataset permissions, changing owners within TrueNAS, attempting permissions without ACL, etc.

Each of these variations was done with fresh dataset for SMB and a wipeout and recreation of docker as well as reinstall of debian.

Any help or suggestions would be greatly appreciated.

Edit: I also tried this with Ubuntu as the docker host and attempted to have docker run under the steve user to disastrous results.

I expected to be able to mount the SMB share on my TrueNAS system on my Debian docker host machine and encounter write errors in the database files that are part of the container. Local docker instances and NFS mounts work fine.

spatak
  • 1

1 Answers1

0

Try to add nobrl in the mount option. Here's a related discussion on Docker forum. From the manpage:

nobrl - Do not send byte range lock requests to the server. This is necessary for certain applications that break with cifs style mandatory byte range locks (and most cifs servers do not yet support requesting advisory byte range locks).

STerliakov
  • 4,983
  • 3
  • 15
  • 37
  • i'll give it a shot. i ended up following a guide for native docker on TrueNAS and have things working as expected. I'll make a new share and see if I can get the nobrl option to get things running. – spatak Mar 24 '23 at 01:42
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 27 '23 at 18:43