jonaswinkler / paperless-ng

A supercharged version of paperless: scan, index and archive all your physical documents
https://paperless-ng.readthedocs.io/en/latest/
GNU General Public License v3.0
5.37k stars 355 forks source link

Management utilities - not found when running in docker? #1366

Open JasonSanDiego opened 2 years ago

JasonSanDiego commented 2 years ago

This isn't my first rodeo with paperless nor docker, but I'm having trouble getting the management utilities to work by following the documentation at https://paperless-ng.readthedocs.io/en/latest/administration.html#management-utilities

I'm running via docker-compose, but whether I try docker-compose or docker, or running bash to get a console, all I get is "executable file not found".

myserver:~$ cd paperless-ng
myserver:~/paperless-ng$ sudo docker-compose exec webserver decrypt_documents --passphrase MYPASSPHRASE
OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "decrypt_documents": executable file not found in $PATH: unknown
myserver:~/paperless-ng$ sudo docker ps
CONTAINER ID   IMAGE                 COMMAND                                            PORTS
ead376e5b62e   paperless_consumer    "/sbin/docker-entryp…"   ting (1) 29 seconds ago                                       sumer_1
2eebfb9554b4   paperless_webserver   "/sbin/docker-entryp…"   hours (healthy)           0.0.0.0:8001->8000/tcp, :::8001->800server_1
8632de6d9f21   redis:6.0             "docker-entrypoint.s…"   hours                     6379/tcp                            ker_1
myserver:~/paperless-ng$ sudo docker exec -it 2eeb decrypt_documents --passphrase MYPASSPHRASE
OCI runtime exec failed: exec failed: container_linux.go:380: pocess caused: exec: "decrypt_documents": executable file not found
myserver:~/paperless-ng$ sudo docker exec -it 2eeb bash
bash-5.0# decrypt_documents
bash: decrypt_documents: command not found

Am I supposed to be executing python manage.py or something else instead?

TobenderZephyr commented 2 years ago

yeah, it seems, you need to use docker exec -it paperless-ng_webserver_1 python manage.py decrypt_documents or docker-compose exec -T webserver python manage.py decrypt_documents.

There seems to be a flaw in the documentation because all "commands" listed there are actually parameters to the command python manage.py

JasonSanDiego commented 2 years ago

Looking through the code base, it seems like install_management_commands sets up a number of the management utilities as direct command line commands, but it doesn’t include decrypt_documents.

See https://github.com/jonaswinkler/paperless-ng/blob/master/docker/install_management_commands.sh