Skip to content

Instantly share code, notes, and snippets.

@jamct
Created April 18, 2024 08:16
Show Gist options
  • Save jamct/09514496da6263114b7ee4cd264ed8f7 to your computer and use it in GitHub Desktop.
Save jamct/09514496da6263114b7ee4cd264ed8f7 to your computer and use it in GitHub Desktop.
Docker-Compose for Paperless-ngx
# The UID and GID of the user used to run paperless in the container. Set this
# to your UID and GID on the host so that you have write access to the
# consumption directory.
USERMAP_UID=1028
USERMAP_GID=100
# Additional languages to install for text recognition, separated by a
# whitespace. Note that this is
# different from PAPERLESS_OCR_LANGUAGE (default=eng), which defines the
# language used for OCR.
# The container installs English, German, Italian, Spanish and French by
# default.
# See https://packages.debian.org/search?keywords=tesseract-ocr-&searchon=names&suite=buster
# for available languages.
PAPERLESS_OCR_LANGUAGES=deu
###############################################################################
# Paperless-specific settings
###############################################################################
# All settings defined in the paperless.conf.example can be used here. The
# Docker setup does not use the configuration file.
# A few commonly adjusted settings are provided below.
# This is required if you will be exposing Paperless-ngx on a public domain
# (if doing so please consider security measures such as reverse proxy)
#PAPERLESS_URL=https://paperless.example.com
# Adjust this key if you plan to make paperless available publicly. It should
# be a very long sequence of random characters. You don't need to remember it.
PAPERLESS_SECRET_KEY=123456789087654321_bitte_aendern!
# Use this variable to set a timezone for the Paperless Docker containers. If not specified, defaults to UTC.
PAPERLESS_TIME_ZONE=Europe/Berlin
# The default language to use for OCR. Set this to the language most of your
# documents are written in.
PAPERLESS_OCR_LANGUAGE=deu
# Set if accessing paperless via a domain subpath e.g. https://domain.com/PATHPREFIX and using a reverse-proxy like traefik or nginx
#PAPERLESS_FORCE_SCRIPT_NAME=/PATHPREFIX
#PAPERLESS_STATIC_URL=/PATHPREFIX/static/ # trailing slash required
#PAPERLESS_CONSUMER_POLLING=30
PAPERLESS_CONSUMER_ASN_BARCODE_PREFIX=ASN
PAPERLESS_CONSUMER_ENABLE_ASN_BARCODE=true
PAPERLESS_CONSUMER_ENABLE_BARCODES=true
PAPERLESS_CONSUMER_BARCODE_SCANNER=ZXING
version: "3.8"
services:
broker:
image: docker.io/library/redis:7
restart: unless-stopped
volumes:
- ./volumes/redis:/data
db:
image: docker.io/library/mariadb:10
restart: unless-stopped
volumes:
- ./volumes/database:/var/lib/mysql
environment:
MARIADB_HOST: paperless
MARIADB_DATABASE: paperless
MARIADB_USER: paperless
MARIADB_PASSWORD: paperless
MARIADB_ROOT_PASSWORD: paperless
webserver:
image: ghcr.io/paperless-ngx/paperless-ngx:latest
restart: unless-stopped
depends_on:
- db
- broker
ports:
- "8000:8000"
volumes:
- ./volumes/data:/usr/src/paperless/data
- ./volumes/media:/usr/src/paperless/media
- ./volumes/export:/usr/src/paperless/export
- ./incoming:/usr/src/paperless/consume
env_file: docker-compose.env
environment:
PAPERLESS_REDIS: redis://broker:6379
PAPERLESS_DBENGINE: mariadb
PAPERLESS_DBHOST: db
PAPERLESS_DBUSER: paperless
PAPERLESS_DBPASS: paperless
PAPERLESS_DBPORT: 3306
@heseber
Copy link

heseber commented May 13, 2024

There seems to be an issue with MariaDB, use a different Docker yml file with Postgres instead, see https://github.com/paperless-ngx/paperless-ngx/tree/dev/docker/compose for options. If you understand German (which I guess you do if you read c't), see also my comment at https://www.heise.de/forum/c-t/Kommentare-zu-c-t-Artikeln/Papierloses-Buero-mit-paperless-ngx/Re-Anleitung-fuer-Synology-in-einigen-Teilen-verwirrend/posting-43929756/show/. I ended up mounting the media directory from the host system but all other volumes as Docker volumes. I made the media directory read-only for all users except the user paperless to avoid unintentional changes by normal users.

@holgi2705
Copy link

The webserver container exits with error code 159 when I start it with docker compose (mariadb and redis start up fine but I had to modify the docker compose a bit for that.

uname -a says:
Linux server01 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux

my docker-compose.yml (webserver section only):

webserver:
image: ghcr.io/paperless-ngx/paperless-ngx:latest
platform: linux/arm64
restart: unless-stopped
depends_on:
- broker
- db
ports:
- "8001:8000"
volumes:
- ./data:/usr/src/paperless/data
- ./media:/usr/src/paperless/media
- ./export:/usr/src/paperless/export
- ./consume:/usr/src/paperless/consume
env_file: docker-compose.env
environment:
PAPERLESS_REDIS: redis://broker:6379
PAPERLESS_DBENGINE: mariadb
PAPERLESS_DBHOST: db
PAPERLESS_DBUSER: paperless
PAPERLESS_DBPASS: paperless
PAPERLESS_DBPORT: 3306

Any ideas to get it up and running??

@woecj
Copy link

woecj commented May 11, 2025

I want to use the postgresql server already running on the host for paperless-ngx.
How should the docker-compose.yml and the docker-compose.env look like for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment