eikek / docspell

Assist in organizing your piles of documents, resulting from scanners, e-mails and other sources with miminal effort.
https://docspell.org
GNU Affero General Public License v3.0
1.59k stars 120 forks source link

Running addon in docker fails: Error response from daemon: invalid mount config for type "bind": bind source path does not exist #2666

Closed tiborrr closed 4 months ago

tiborrr commented 4 months ago
          I do not think it works correctly yet.

I am now getting this error:

Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /tmp/docspell-addons/addon-14483220073169593010.
Thu, May 30th, 2024, 14:16: Running external command: docker run --rm --name docspell-addon-example-0.7.0-4B1nxM --mount type=bind,source=/tmp/docspell-addons/addon-14483220073169593010,target=/mnt/work --mount type=bind,source=/tmp/docspell-addons/addon-output-10138378789386319765,target=/mnt/output --mount type=bind,source=/tmp/docspell-addon-cache/EXpNaSFCvTP-eXs6FcYKdaS-41zyL95tTUR-jJERLW2CNkj,target=/mnt/cache --network none --env ADDON_DIR=addons/docspell-addon-example-0.7.0 --env ITEM_DATA_JSON=item/item-data.json --env DSC_DOCSPELL_URL=http://localhost:7880 --env ITEM_DIR=item --env TMP_DIR=temp --env TMPDIR=temp --env CACHE_DIR=/mnt/cache --env ITEM_ARGS_JSON=item/given-data.json --env ITEM_ORIGINAL_JSON=item/source-files.json --env DSC_SESSION=1717078614008-MS9ldHMvNldTa1dQaTl5dDYtTXROMmYzVXlwRGctY2tRQTZka1lOZG4tTlRIczJjTnhkTkgvYWRtaW4=-false-900-$2a$10$/xwLHsshpLKSDGii55kbUu-a8eFZrPefIXqO6qxnktUXLwPC/A= --env ITEM_PDF_JSON=item/pdf-files.json --env OUTPUT_DIR=/mnt/output --env ITEM_ORIGINAL_DIR=item/originals --env ITEM_PDF_DIR=item/pdfs -w /mnt/work tiborr/docspell-addon-example:latest arguments/user-input
Thu, May 30th, 2024, 14:16: Waiting for command to terminate…
Thu, May 30th, 2024, 14:16: >> [docspell-addon-example-0.7.0 (err)] docker: Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /tmp/docspell-addons/addon-14483220073169593010.
Thu, May 30th, 2024, 14:16: >> [docspell-addon-example-0.7.0 (err)] See 'docker run --help'.
Thu, May 30th, 2024, 14:16: >> [docspell-addon-example-0.7.0 (err)]

I also think it's weird you are getting this pull access denied for tiborr/docspell-addon-example because this is a public repo.

link to docker hub

Can you check what happens if you do docker pull tiborr/docspell-addon-example in your joex instance

Originally posted by @tiborrr in https://github.com/eikek/docspell/issues/2650#issuecomment-2139689454

eikek commented 4 months ago

This is what I get:

$ docker pull tiborr/docspell-addon-example
Using default tag: latest
Error response from daemon: pull access denied for tiborr/docspell-addon-example, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

I assume I have to configure something perhaps?

tiborrr commented 4 months ago

How stupid. I already found the issue. Can you update the plugin and retry once?

I made a typo. It should be:

tiborrr/docspell-addon-example

eikek commented 4 months ago

I retried with your plugin version 0.8.0 and it's getting better :)

First try, it seems to work but the main.py cannot be found:

>> [docspell-addon-example-0.8.0 (err)] Status: Downloaded newer image for tiborrr/docspell-addon-example:0.8.0 (addon-version: "0.8.0", task: "process-item", addon-task-id: "J5QnTyfi7o6-vDWGyp32pVz-s9Te5iVxcCC-94cVVoem1mX", jobInfo: "GghTru99N.../1/process-item/High", addon-name: "docspell-addon-example", jobId: "GghTru99NH7-1QU2W7RB6dY-77cjRCrAiER-sg3CjtpePXf", group: "1")
>> [docspell-addon-example-0.8.0 (err)] python: can't open file '/mnt/work/main.py': [Errno 2] No such file or directory (addon-version: "0.8.0", task: "process-item", addon-task-id: "J5QnTyfi7o6-vDWGyp32pVz-s9Te5iVxcCC-94cVVoem1mX", jobInfo: "GghTru99N.../1/process-item/High", addon-name: "docspell-addon-example", jobId: "GghTru99NH7-1QU2W7RB6dY-77cjRCrAiER-sg3CjtpePXf", group: "1")
>> [docspell-addon-example-0.8.0 (err)]  (addon-version: "0.8.0", task: "process-item", addon-task-id: "J5QnTyfi7o6-vDWGyp32pVz-s9Te5iVxcCC-94cVVoem1mX", jobInfo: "GghTru99N.../1/process-item/High", addon-name: "docspell-addon-example", jobId: "GghTru99NH7-1QU2W7RB6dY-77cjRCrAiER-sg3CjtpePXf", group: "1")
Closing process: `docker run --rm --name docspell-addon-example-0.8.0-cpBhP --mount type=bind,source=/tmp/docspell-addons/addon-1492956184831617862,target=/mnt/work --mount type=bind,source=/tmp/docspell-addons/addon-output-1673668666144778459,target=/mnt/output --mount type=bind,source=/tmp/docspell-addon-cache/J5QnTyfi7o6-vDWGyp32pVz-s9Te5iVxcCC-94cVVoem1mX,target=/mnt/cache --network none --env ADDON_DIR=addons/docspell-addon-example-0.8.0 --env ITEM_DATA_JSON=item/item-data.json --env ITEM_DIR=item --env TMP_DIR=temp --env TMPDIR=temp --env CACHE_DIR=/mnt/cache --env ITEM_ARGS_JSON=item/given-data.json --env ITEM_ORIGINAL_JSON=item/source-files.json --env ITEM_PDF_JSON=item/pdf-files.json --env OUTPUT_DIR=/mnt/output --env ITEM_ORIGINAL_DIR=item/originals --env ITEM_PDF_DIR=item/pdfs -w /mnt/work tiborrr/docspell-addon-example:0.8.0 arguments/user-input` (addon-version: "0.8.0", task: "process-item", addon-task-id: "J5QnTyfi7o6-vDWGyp32pVz-s9Te5iVxcCC-94cVVoem1mX", jobInfo: "GghTru99N.../1/process-item/High", addon-name: "docspell-addon-example", jobId: "GghTru99NH7-1QU2W7RB6dY-77cjRCrAiER-sg3CjtpePXf", group: "1")
Addon docspell-addon-example-0.8.0 returned non-zero: 2 (addon-version: "0.8.0", task: "process-item", addon-task-id: "J5QnTyfi7o6-vDWGyp32pVz-s9Te5iVxcCC-94cVVoem1mX", jobInfo: "GghTru99N.../1/process-item/High", addon-name: "docspell-addon-example",jobId: "GghTru99NH7-1QU2W7RB6dY-77cjRCrAiER-sg3CjtpePXf", group: "1")
Addon result: AddonExecutionResult(List(ExecutionError(2)),true) (task: "process-item", addon-task-id: "J5QnTyfi7o6-vDWGyp32pVz-s9Te5iVxcCC-94cVVoem1mX", jobInfo: "GghTru99N.../1/process-item/High", jobId: "GghTru99NH7-1QU2W7RB6dY-77cjRCrAiER-sg3CjtpePXf", group: "1")

I set the working dir to a directory prepared at the host (bound to /mnt/work in the container). This is used to lookup the main.py. Perhaps you could use an absolute path in the entrypoint?

If I remove that option, it works fine:

Running external command: docker run --rm --name docspell-addon-example-0.8.0-3JGAia --mount type=bind,source=/tmp/docspell-addons/addon-11732978759257757192,target=/mnt/work --mount type=bind,source=/tmp/docspell-addons/addon-output-11868189249312441700,target=/mnt/output --mount type=bind,source=/tmp/docspell-addon-cache/J5QnTyfi7o6-vDWGyp32pVz-s9Te5iVxcCC-94cVVoem1mX,target=/mnt/cache --network none --env ADDON_DIR=addons/docspell-addon-example-0.8.0 --env ITEM_DATA_JSON=item/item-data.json --env ITEM_DIR=item --env TMP_DIR=temp --env TMPDIR=temp --env CACHE_DIR=/mnt/cache --env ITEM_ARGS_JSON=item/given-data.json --env ITEM_ORIGINAL_JSON=item/source-files.json --env ITEM_PDF_JSON=item/pdf-files.json --env OUTPUT_DIR=/mnt/output --env ITEM_ORIGINAL_DIR=item/originals --env ITEM_PDF_DIR=item/pdfs tiborrr/docspell-addon-example:0.8.0 arguments/user-input
Waiting for command to terminate…
>> [docspell-addon-example-0.8.0 (out)] Hello arguments/user-input
>> [docspell-addon-example-0.8.0 (out)]
Closing process: `docker run --rm --name docspell-addon-example-0.8.0-3JGAia --mount type=bind,source=/tmp/docspell-addons/addon-11732978759257757192,target=/mnt/work --mount type=bind,source=/tmp/docspell-addons/addon-output-11868189249312441700,target=/mnt/output --mount type=bind,source=/tmp/docspell-addon-cache/J5QnTyfi7o6-vDWGyp32pVz-s9Te5iVxcCC-94cVVoem1mX,target=/mnt/cache --network none --env ADDON_DIR=addons/docspell-addon-example-0.8.0 --env ITEM_DATA_JSON=item/item-data.json --env ITEM_DIR=item --env TMP_DIR=temp --env TMPDIR=temp --env CACHE_DIR=/mnt/cache --env ITEM_ARGS_JSON=item/given-data.json --env ITEM_ORIGINAL_JSON=item/source-files.json --env ITEM_PDF_JSON=item/pdf-files.json --env OUTPUT_DIR=/mnt/output --env ITEM_ORIGINAL_DIR=item/originals --env ITEM_PDF_DIR=item/pdfs tiborrr/docspell-addon-example:0.8.0 arguments/user-input`
Addon docspell-addon-example-0.8.0 executed successfully!
tiborrr commented 4 months ago

I updated it. Now the example should work.

Once it works it would be great to add this somewhere for other people to use.

If you do the update and run it again, then it should work.

eikek commented 4 months ago

I tested it again successfully! Thank you for testing this!

Where do you like to add this example? If you want you can add it somewhere in the docs, and/or also use a topic on github docspell-addon (makes it easier to discover, like this)?

Edit: Perhaps it could be added to this page: https://docspell.org/docs/addons/writing/#examples

tiborrr commented 4 months ago

Both would be best. Then what you have on your website reflects what is in the docspell repo. How do we achieve that result? Do you fork my example repo? Or can you make some kind of link?

If you decide to fork it, then make sure to adjust the .github files. Because they currently point to my docker repo.

tiborrr commented 4 months ago

I have updated my repo so its easier to port. I have made the things that require configuration a Github secret in the github release file.

eikek commented 4 months ago

I don't think it needs to be forked - or do you intend to remove it from your account soon? I would simply point to it in the docs.

tiborrr commented 4 months ago

Pointing to it in the docs would be fine. I do not intend to remove it.

tiborrr commented 1 month ago

Found the issue. This was caused by a missing volume in the docker compose.

volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /tmp:/tmp # this line was misssing