[GH-ISSUE #80] Docker Image Set GID an UID with environment variables #62

Closed
opened 2026-02-25 21:31:07 +03:00 by kerem · 11 comments
Owner

Originally created by @Philap95 on GitHub (Aug 19, 2020).
Original GitHub issue: https://github.com/ciur/papermerge/issues/80

Hi,
im using a Synology Nas (DS218+) and want to run the docker container, but every time i get issues with the file permissions between the container and host filesystem, yeah setting rights to public on the Nas should make it work, but for private documents thats not an option, so it would great to be able to set the Gid and Uid in the environment variables of the container.

Maybe this could help https://vsupalov.com/docker-shared-permissions/

Originally created by @Philap95 on GitHub (Aug 19, 2020). Original GitHub issue: https://github.com/ciur/papermerge/issues/80 Hi, im using a Synology Nas (DS218+) and want to run the docker container, but every time i get issues with the file permissions between the container and host filesystem, yeah setting rights to public on the Nas should make it work, but for private documents thats not an option, so it would great to be able to set the Gid and Uid in the environment variables of the container. Maybe this could help [https://vsupalov.com/docker-shared-permissions/](https://vsupalov.com/docker-shared-permissions/)
kerem closed this issue 2026-02-25 21:31:07 +03:00
Author
Owner

@Tooa commented on GitHub (Aug 23, 2020):

Recently, Linuxserver released a Papermerge Docker build with PGID and PUID support here.

<!-- gh-comment-id:678775656 --> @Tooa commented on GitHub (Aug 23, 2020): Recently, `Linuxserver` released a Papermerge Docker build with `PGID` and `PUID` support [here](https://hub.docker.com/r/linuxserver/papermerge).
Author
Owner

@Philap95 commented on GitHub (Aug 23, 2020):

Hello @Tooa , that's good news for me, sounds very good, thanks for your reply, i will set it up now and test it, thanks a lot 😊

<!-- gh-comment-id:678778142 --> @Philap95 commented on GitHub (Aug 23, 2020): Hello @Tooa , that's good news for me, sounds very good, thanks for your reply, i will set it up now and test it, thanks a lot 😊
Author
Owner

@okoetter commented on GitHub (Sep 16, 2020):

I am using Linuxserver's docker image and it's way easier to setup on my Synology NAS than the original docker files. But does anybody know how to use the worker to monitor a directory with scans with it?

<!-- gh-comment-id:693423861 --> @okoetter commented on GitHub (Sep 16, 2020): I am using `Linuxserver`'s docker image and it's way easier to setup on my Synology NAS than the original docker files. But does anybody know how to use the worker to monitor a directory with scans with it?
Author
Owner

@ciur commented on GitHub (Sep 17, 2020):

Hi @okoetter!

The setting you are looking for is IMPORTER_DIR. You need to change it only on worker side/container.

The thing is, I don't run Papermerge via Docker on the daily basis, so it is very difficult for me to advice you how to correctly play nicely with docker images.
I assume you need somehow to map your local/network folder to same point IMPORTER_DIR is pointing to within docker image.

I updated documentation with how to apply changes in Docker Container.

Maybe there are docker experts in this thread who can help you (and me!) in regards of docker image. Given such useful info, I will gladly update documentation.

<!-- gh-comment-id:693922685 --> @ciur commented on GitHub (Sep 17, 2020): Hi @okoetter! The setting you are looking for is [IMPORTER_DIR](https://papermerge.readthedocs.io/en/latest/settings.html#document-importer). You need to change it only on worker side/container. The thing is, I don't run Papermerge via Docker on the daily basis, so it is very difficult for me to advice you how to correctly play nicely with docker images. I assume you need somehow to map your local/network folder to same point [IMPORTER_DIR](https://papermerge.readthedocs.io/en/latest/settings.html#document-importer) is pointing to within docker image. I updated documentation with how to [apply changes in Docker Container](https://papermerge.readthedocs.io/en/latest/setup/docker.html#configuration-changes-in-docker-container). Maybe there are docker experts in this thread who can help you (and me!) in regards of docker image. Given such useful info, I will gladly update documentation.
Author
Owner

@okoetter commented on GitHub (Sep 17, 2020):

Hi @ciur,
thanks for your answer.
No, I do not need help how to map my local folder to the docker image. And the use of IMPORTER_DIR is also clear. What I don't understand is how I get the second container (worker container. I don't use the third db container as I want to use sqlite). I only have the main app container.
I cannot use your docker files as docker-compose up does not build correctly on my Synology NAS. When I am asked for the region and I enter 8 for Europe nothing happens.
So I chose Linuxserver's docker image as I made some good experiences with his images. But that is only the main app container and I also need a worker container to import from my scans folder, correct? Or can I do both in one container?

<!-- gh-comment-id:694045559 --> @okoetter commented on GitHub (Sep 17, 2020): Hi @ciur, thanks for your answer. No, I do not need help how to map my local folder to the docker image. And the use of `IMPORTER_DIR` is also clear. What I don't understand is how I get the second container (worker container. I don't use the third db container as I want to use sqlite). I only have the main app container. I cannot use your docker files as `docker-compose up` does not build correctly on my Synology NAS. When I am asked for the region and I enter 8 for Europe nothing happens. So I chose `Linuxserver`'s docker image as I made some good experiences with his images. But that is only the main app container and I also need a worker container to import from my scans folder, correct? Or can I do **both in one container**?
Author
Owner

@sizzicus commented on GitHub (Sep 17, 2020):

@okoetter

I figured this out for myself last night:

If you're using the linuxserver.io image you can set the IMPORTER_DIR setting in papermerge.conf.py in the image's /config directory. Then it seems to work fine. Not an ideal solution, but the linuxserver image only allows a few env variables passed in.

Maybe it would also work to maintain your own papermerge.conf.py and pass it into the linuxserver image with bind mount.

<!-- gh-comment-id:694332785 --> @sizzicus commented on GitHub (Sep 17, 2020): @okoetter I figured this out for myself last night: If you're using the linuxserver.io image you can set the IMPORTER_DIR setting in papermerge.conf.py in the image's /config directory. Then it seems to work fine. Not an ideal solution, but the linuxserver image only allows a few env variables passed in. Maybe it would also work to maintain your own papermerge.conf.py and pass it into the linuxserver image with bind mount.
Author
Owner

@okoetter commented on GitHub (Sep 18, 2020):

@sizzicus
Thanks for the info. I will create a "/scan" directory inside the container, point IMPORTER_DIR to that and map that folder within Docker to the real external dir.
But does the one linuxserver.io image also provide periodically calling the worker app to check the import folder for new scans?
I thought there was a second container needed for that.

<!-- gh-comment-id:694731846 --> @okoetter commented on GitHub (Sep 18, 2020): @sizzicus Thanks for the info. I will create a "/scan" directory inside the container, point IMPORTER_DIR to that and map that folder within Docker to the real external dir. But does the one linuxserver.io image also provide periodically calling the worker app to check the import folder for new scans? I thought there was a second container needed for that.
Author
Owner

@sizzicus commented on GitHub (Sep 19, 2020):

The auto importing definitely works correctly once you tell it where to look, so they must have correctly integrated all three parts of this app. (linuxserver.io is all about making single integrated images that all work on the same base image and setup rules)

On 09/18/2020 4:25 AM Oliver Kötter <notifications@github.com> wrote:




@sizzicus https://github.com/sizzicus
Thanks for the info. I will create a "/scan" directory inside the container, point IMPORTER_DIR to that and map that folder within Docker to the real external dir.
But does the one linuxserver.io image also provide periodically calling the worker app to check the import folder for new scans?
I thought there was a second container needed for that.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/ciur/papermerge/issues/80#issuecomment-694731846 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AOH4EZYIYV67TEJFC33VYT3SGMKQXANCNFSM4QFMBFMA .
<!-- gh-comment-id:695337467 --> @sizzicus commented on GitHub (Sep 19, 2020): The auto importing definitely works correctly once you tell it where to look, so they must have correctly integrated all three parts of this app. (linuxserver.io is all about making single integrated images that all work on the same base image and setup rules) > On 09/18/2020 4:25 AM Oliver Kötter <notifications@github.com> wrote: > > > > > @sizzicus https://github.com/sizzicus > Thanks for the info. I will create a "/scan" directory inside the container, point IMPORTER_DIR to that and map that folder within Docker to the real external dir. > But does the one linuxserver.io image also provide periodically calling the worker app to check the import folder for new scans? > I thought there was a second container needed for that. > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub https://github.com/ciur/papermerge/issues/80#issuecomment-694731846 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AOH4EZYIYV67TEJFC33VYT3SGMKQXANCNFSM4QFMBFMA . >
Author
Owner

@okoetter commented on GitHub (Sep 20, 2020):

OK, I can't get it to work.

This is what I've done:

  • shell inside the container with docker exec -it linuxserver-papermerge1 /bin/bash and create /import folder
  • mount my nas folder /volume1/scan to docker container's /import
  • check that my pdf are visible inside container's /import by ls -l /import
  • check that IMPORTER_DIR is set correctly by cat /config/papermerge.conf.py:
    IMPORTER_DIR = "/import/"
  • restart container

but my pdfs never show up in Papermerge. What am I doing wrong?

<!-- gh-comment-id:695771027 --> @okoetter commented on GitHub (Sep 20, 2020): OK, I can't get it to work. This is what I've done: - shell inside the container with `docker exec -it linuxserver-papermerge1 /bin/bash` and create `/import` folder - mount my nas folder `/volume1/scan` to docker container's `/import` - check that my pdf are visible inside container's `/import` by `ls -l /import` - check that IMPORTER_DIR is set correctly by `cat /config/papermerge.conf.py`: IMPORTER_DIR = "/import/" - restart container but my pdfs never show up in Papermerge. What am I doing wrong?
Author
Owner

@sizzicus commented on GitHub (Sep 21, 2020):

Hi,

I didn't need to enter the running container to make this work.

  1. I have the container's /config directory mapped out to a volume called docs_config. This should work for a direct path mount also.

  2. After starting up the container for the first time, it generates papermerge.conf.py in that volume.

  3. I stopped/removed the container (docker-compose down) and then edited that file from the host system to add an importer_dir entry below the rest of the path settings:

MEDIA_DIR = "/data/media" STATIC_DIR = "/app/papermerge/static" MEDIA_URL = "/media/" STATIC_URL = "/static/" IMPORTER_DIR = "/import/"
  1. I edited my docker compose file to add a bind mount mapping for /import:
  • ./import:/import

(you do not have to create the /import directory inside the running container)

  1. I created/started the container again and found it working - it detects a new file in <30s probably? You should see the worker printing out log entries in docker-compose logs -f even if the importer is not set up. If it is working, you will see something like this when it finds your file:

papermerge | [2020-09-21 00:41:16,744: INFO/ForkPoolWorker-2] Importing file /import/dummy.pdf...
papermerge | [2020-09-21 00:41:16,749: INFO/ForkPoolWorker-2] Same as temp_file_name=/tmp/tmp3u7a2292/dummy.pdf...
papermerge | [2020-09-21 00:41:16,754: DEBUG/ForkPoolWorker-2] Importing file /tmp/tmp3u7a2292/dummy.pdf.
papermerge | [2020-09-21 00:41:16,964: DEBUG/ForkPoolWorker-2] Post save doc => normalize_pages
papermerge | [2020-09-21 00:41:16,968: DEBUG/ForkPoolWorker-2] Normalizing document 12
etc...

I hope this helps!

On 09/20/2020 6:32 AM Oliver Kötter <notifications@github.com> wrote:




OK, I can't get it to work.

This is what I've done:

    * shell inside the container with docker exec -it linuxserver-papermerge1 /bin/bash and create /import folder
    * mount my nas folder /volume1/scan to docker container's /import
    * check that my pdf are visible inside container's /import by ls -l /import
    * check that IMPORTER_DIR is set correctly by cat /config/papermerge.conf.py:
      IMPORTER_DIR = "/import/"
    * restart container

but my pdfs never show up in Papermerge. What do I do wrong?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/ciur/papermerge/issues/80#issuecomment-695771027 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AOH4EZ4FTSECZPBGQE6IJBLSGXK4HANCNFSM4QFMBFMA .
<!-- gh-comment-id:695859970 --> @sizzicus commented on GitHub (Sep 21, 2020): Hi, I didn't need to enter the running container to make this work. 1) I have the container's /config directory mapped out to a volume called docs_config. This should work for a direct path mount also. 2) After starting up the container for the first time, it generates papermerge.conf.py in that volume. 3) I stopped/removed the container (docker-compose down) and then edited that file from the host system to add an importer_dir entry below the rest of the path settings: <other stuff> MEDIA_DIR = "/data/media" STATIC_DIR = "/app/papermerge/static" MEDIA_URL = "/media/" STATIC_URL = "/static/" IMPORTER_DIR = "/import/" <other stuff> 4) I edited my docker compose file to add a bind mount mapping for /import: - ./import:/import (you do not have to create the /import directory inside the running container) 5) I created/started the container again and found it working - it detects a new file in <30s probably? You should see the worker printing out log entries in docker-compose logs -f even if the importer is not set up. If it is working, you will see something like this when it finds your file: papermerge | [2020-09-21 00:41:16,744: INFO/ForkPoolWorker-2] Importing file /import/dummy.pdf... papermerge | [2020-09-21 00:41:16,749: INFO/ForkPoolWorker-2] Same as temp_file_name=/tmp/tmp3u7a2292/dummy.pdf... papermerge | [2020-09-21 00:41:16,754: DEBUG/ForkPoolWorker-2] Importing file /tmp/tmp3u7a2292/dummy.pdf. papermerge | [2020-09-21 00:41:16,964: DEBUG/ForkPoolWorker-2] Post save doc => normalize_pages papermerge | [2020-09-21 00:41:16,968: DEBUG/ForkPoolWorker-2] Normalizing document 12 etc... I hope this helps! > On 09/20/2020 6:32 AM Oliver Kötter <notifications@github.com> wrote: > > > > > OK, I can't get it to work. > > This is what I've done: > > * shell inside the container with docker exec -it linuxserver-papermerge1 /bin/bash and create /import folder > * mount my nas folder /volume1/scan to docker container's /import > * check that my pdf are visible inside container's /import by ls -l /import > * check that IMPORTER_DIR is set correctly by cat /config/papermerge.conf.py: > IMPORTER_DIR = "/import/" > * restart container > > but my pdfs never show up in Papermerge. What do I do wrong? > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub https://github.com/ciur/papermerge/issues/80#issuecomment-695771027 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AOH4EZ4FTSECZPBGQE6IJBLSGXK4HANCNFSM4QFMBFMA . >
Author
Owner

@okoetter commented on GitHub (Sep 21, 2020):

I got it working now, thanks for your help. It was a permissions problem with my scan share on my NAS.

To get German OCR working in Linuxserver's image I had to bash into the container and

  • apt update
  • apt install tesseract-ocr-deu to install the German tesseract package

Hope that helps others.

<!-- gh-comment-id:695958179 --> @okoetter commented on GitHub (Sep 21, 2020): I got it working now, thanks for your help. It was a permissions problem with my scan share on my NAS. To get German OCR working in `Linuxserver`'s image I had to bash into the container and - `apt update` - `apt install tesseract-ocr-deu` to install the German tesseract package Hope that helps others.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/papermerge#62
No description provided.