LINUX, FOSS AND LIBRARY TECHNOLOGY ENTHUSIAST

Tuesday, April 22, 2025

Setting Up Paperless-ngx with Docker Compose

0 comments

In today's digital age, managing documents efficiently is essential, whether you're running a personal archive or a library. One great open-source solution for this purpose is Paperless-ngx — a powerful document management system that helps you digitize, archive, tag, and search your documents easily.

In this post, I’ll Walk you through setting up Paperless-ngx using Docker Compose on a Linux server. This method is clean, fast, and maintainable — perfect for both tech enthusiasts and library technologists.

What is Paperless-ngx?

Paperless-ngx is a community-supported fork of the original Paperless project. It’s a document management system that:

  • Allows scanning and uploading of documents
  • Performs OCR (Optical Character Recognition)
  • Supports metadata tagging
  • Provides a full-text search engine
  • Offers multi-user support and access control

Requirements

  • A Linux system with Docker and Docker Compose installed
  • Basic knowledge of Linux command line
  • Around 2 GB of memory
  • A dedicated directory for storing volumes and configuration

Step-by-Step Installation Guide

1. Install Docker if not, using this post


2. Create Your Project Directory

sudo mkdir -p /docker/paperless-ngx && cd /docker/paperless-ngx

3. Create Environment File

Create a .env file to store the environment variables:

sudo vim docker-compose.env

Paste the following:

PAPERLESS_SECRET_KEY=change_this_to_a_long_random_secret
PAPERLESS_TIME_ZONE=Asia/Kolkata
PAPERLESS_ADMIN_USER=admin
PAPERLESS_ADMIN_PASSWORD=admin123
PAPERLESS_ADMIN_MAIL=admin@example.com

Important: Replace the PAPERLESS_SECRET_KEY, admin credentials, and email with your own secure values.

4. Create Docker Compose File

sudo vim docker-compose.yml

Paste the following configuration:

services:
  broker:
    image: docker.io/library/redis:7
    restart: unless-stopped
    volumes:
      - redisdata:/data

  db:
    image: docker.io/library/mariadb:11
    restart: unless-stopped
    volumes:
      - dbdata:/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:
      - 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

volumes:
  data:
  media:
  dbdata:
  redisdata:

5. Start the Services

Now it’s time to bring everything up:

sudo docker compose up -d

Check the status:

sudo docker compose ps

5. Access Your Paperless System

Open your browser and visit:

http://<your-server-ip>:8000

Login using the admin credentials you set in the .env file.

No comments:

Post a Comment