Calibre not working on QNAP Container with PID / PGID set

Hi. I’m trying to run Calibre on QNAP with a shared folder “/books” owned by “dockeruser” (1004/1001).

If I don’t set the PUID / PGID env variables in the container, it runs, but has no permissions to access /books shared folder (even though /books is mapped).

If I set the PUID/PGID to the values for dockeruser, I get:

Obt-Message: Xinerama extension is not present on the server
Openbox-Message: Unable to find a valid menu file “/var/lib/openbox/debian-menu.xml”
/usr/bin/env: ‘python’: No such file or directory
guacd[428]: INFO: Guacamole connection closed during handshake
chansrv::main: using log file [/tmp/xrdp-chansrv.1.log]
Could not start log
error opening log file [The log is not properly started]. quitting.
rdpRRGetInfo:
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to ‘/tmp/runtime-abc’
QStandardPaths: runtime directory ‘/tmp/runtime-abc’ is not owned by UID 1004, but a directory permissions 0700 owned by UID 911 GID 911
qt.qpa.xcb: QXcbConnection: XCB error: 148 (Unknown), sequence: 185, resource id: 0, major code: 140 (Unknown), minor code: 20
chansrv::main: using log file [/tmp/xrdp-chansrv.1.log]
Could not start log
error opening log file [The log is not properly started]. quitting.

It appears to me that the container is run under a random user ID, and then it resets to the PUID provided, but loses access to its own folders. How can I run the container under the correct PUID while at the same time give it access to the shared folder?

Thanks in advance.

After a night of tinkering I found the answer myself, so posting if anyone has similar issues.

It appears that the problem was due to having downloaded the docker image before the dockeruser was created.

I solved it by following the following steps:

  • Deleted the downloaded docker image
  • created the UID and PID which would be used
  • instead of using the QNAP GUI to create the container, I used the docker compose YAML, including the variables for PUID and PGID
  • this appeared to download the correct image and set the permissions, but I got different errors from within the container
  • deleted the container again (but not the image)
  • re-created the container using the GUI, but using the already downloaded local image

I also installed Portainer for much easier management of the containers. It seems to work now.

Happy days.