Joplin Server Docker doesn't work with mapped drives

Operating system

Linux

Joplin version

2.14.20

Sync target

Joplin Server

What issue do you have?

Docker Joplin Server won't utilize external drives.

I've beat my head on this for weeks now.

I've run through the setup process so many times that I've bumped into the LetsEncrypt weekly cert limit.

My compose-docker file looks like this:

'''
services:
	db:
		restart: unless-stopped
		image: postgres:latest
	ports:
		- "5432:5432"
	volumes:
		- /mnt/joplin-data/:/var/lib/postgresql/data
	environment:
		- POSTGRES_PASSWORD=mypassword
		- POSTGRES_USER=joplin
		- POSTGRES_DB=joplin
	app:
	environment:
		- APP_BASE_URL=https://my-server.com/joplin
		- APP_PORT=22300
		- POSTGRES_PASSWORD=mypassword
		- POSTGRES_DATABASE=joplin
		- POSTGRES_USER=joplin
		- POSTGRES_PORT=5432
		- POSTGRES_HOST=db
		- DB_CLIENT=pg
		restart: unless-stopped
		image: etechonomy/joplin-server:latest
	ports:
		- "22300:22300"
	depends_on:
		- db'''

Where /mnt/joplin-data is mounted via /etc/fstab like this:

//192.168.10.10/homes/chris/Joplin /mnt/joplin-data cifs credentials=/home/username/cifs.creds

The mount works perfectly fine, but when running sudo docker compose down, sudo docker compose pull, sudo docker compose up, I get this:

It's complaining "could not change permissions of directory "/var/lib/postgresql/data": Operation not supported".

So, removing the mount statement from /etc/fstab and rebooting. I put a copy of the Joplin data files in a local folder named /mnt/joplin-data.

I do a sudo docker compose down, sudo docker compose pull, sudo docker compose up, and I get this:

And everything is fine. The server works, yadda, yadda, yadda. Trouble is it's stored locally and this isn't the biggest SD Card in the world.

Here's where it get's really weird.

If I do the mount from the command line: sudo mount -t cifs -o credentials=/home/username/cifs.creds //192.168.10.10/homes/chris/Joplin /mnt/joplin-data, it still works.

Until it get's rebooted and it all goes to foo-foo.

So, I'm reaching out for assistance.

What have I gotten wrong?

thanks

chris

Screenshots



I am working at the edge of my knowledge here so this is more some thoughts rather than a solution.

When you access //192.168.10.10/homes/chris/Joplin via /mnt/joplin-data directly from your docker RasPi it has write permissions for the SMB shared folder (//192.168.10.10/homes/chris/Joplin).

When you map that share (via /mnt/joplin-data) to /var/lib/postgresql/data in the Postgresql container, the container is using the share as if it were /var/lib/postgresql/data.

Note the error does NOT say that the operation is not supported but that the operation is not permitted. It also says that /var/lib/postgresql/data has wrong ownership and that the server must be started by the user that owns the data directory.

As @MrKanister pointed out in the other thread the Postgresql container writes to /var/lib/postgresql/data as user 999, which is the postgres user within the postgres container. I am wondering if the write fails with Operation not permitted is because user 999 has no write permissions for the //192.168.10.10/homes/chris/Joplin SMB share.

So although the Postgresql container thinks it is writing to /var/lib/postgresql/data it is actually writing to //192.168.10.10/homes/chris/Joplin and user 999 is not allowed?

As a test, what happens if /homes/chris/Joplin on 192.168.10.10 is set to allow writes from anyone?

The other possible alternative is to try mounting an NFS share on 192.168.10.10 as /mnt/joplin-data on your RasPi. I believe that NFS shares do not use the same kind of permissions as SMB and access is authorised using the IP address of the connecting machine (your docker RasPi).

As stated above I am more thinking this through with you than offering definite solutions.

If anyone more knowledgeable can shed light on what is happening please put us right...

1 Like

Soooo,

If I change from a CIFS mount to a NFS mount, it seems to work.

H'mmmm

1 Like

Glad you solved it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.