docker.recipes

HedgeDoc

intermediate

Real-time collaborative markdown editor.

Overview

HedgeDoc is a real-time collaborative markdown editor that emerged from the CodiMD project, itself a fork of the original HackMD. It enables multiple users to simultaneously edit markdown documents with live preview, real-time synchronization, and rich formatting capabilities including diagrams, mathematical equations, and embedded media. Unlike simple text editors, HedgeDoc provides a web-based platform where teams can collaborate on documentation, meeting notes, and technical specifications with the power of markdown syntax. This Docker stack pairs HedgeDoc with PostgreSQL to create a robust, self-hosted documentation platform. PostgreSQL serves as the backend database, storing document content, user sessions, revision history, and metadata with ACID compliance and reliability. The combination provides enterprise-grade data integrity for collaborative editing scenarios where document consistency and user management are critical. This setup is ideal for development teams, technical writers, and organizations requiring a private, feature-rich alternative to cloud-based collaborative editors. The PostgreSQL backend ensures data sovereignty while supporting complex queries for document search and user management, making it suitable for environments with compliance requirements or teams handling sensitive documentation that cannot be stored on third-party platforms.

Key Features

  • Real-time collaborative editing with live cursor tracking and user presence indicators
  • Comprehensive markdown support including Mermaid diagrams, MathJax equations, and syntax highlighting
  • PostgreSQL-backed revision history with full document versioning and rollback capabilities
  • User authentication and permission management with document sharing controls
  • Export functionality to PDF, HTML, and various document formats
  • Plugin architecture supporting custom renderers and extensions
  • Presentation mode for creating slideshow presentations from markdown content
  • Full-text search across documents powered by PostgreSQL's advanced search capabilities

Common Use Cases

  • 1Software development teams creating and maintaining technical documentation and API specifications
  • 2Academic institutions hosting collaborative research papers and course materials
  • 3Engineering teams managing meeting notes, project specifications, and knowledge bases
  • 4Startups building internal wikis and documentation systems with version control
  • 5Technical writing teams collaborating on user manuals and help documentation
  • 6Open source projects providing contributor-friendly documentation platforms
  • 7Organizations migrating from proprietary collaboration tools to self-hosted solutions

Prerequisites

  • Docker Engine 20.10+ and Docker Compose V2 for container orchestration
  • Minimum 1GB RAM for PostgreSQL optimal performance with concurrent users
  • Port 3000 available for HedgeDoc web interface access
  • DB_PASSWORD environment variable configured for PostgreSQL authentication
  • Basic understanding of markdown syntax and collaborative editing workflows
  • SSL certificate and reverse proxy setup for production deployments

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 hedgedoc:
3 image: quay.io/hedgedoc/hedgedoc:latest
4 container_name: hedgedoc
5 restart: unless-stopped
6 environment:
7 CMD_DB_URL: postgres://hedgedoc:${DB_PASSWORD}@postgres:5432/hedgedoc
8 CMD_DOMAIN: localhost
9 CMD_URL_ADDPORT: "true"
10 volumes:
11 - hedgedoc_uploads:/hedgedoc/public/uploads
12 ports:
13 - "3000:3000"
14 depends_on:
15 - postgres
16 networks:
17 - hedgedoc
18
19 postgres:
20 image: postgres:15-alpine
21 container_name: hedgedoc-postgres
22 restart: unless-stopped
23 environment:
24 POSTGRES_USER: hedgedoc
25 POSTGRES_PASSWORD: ${DB_PASSWORD}
26 POSTGRES_DB: hedgedoc
27 volumes:
28 - postgres_data:/var/lib/postgresql/data
29 networks:
30 - hedgedoc
31
32volumes:
33 hedgedoc_uploads:
34 postgres_data:
35
36networks:
37 hedgedoc:
38 driver: bridge

.env Template

.env
1DB_PASSWORD=changeme

Usage Notes

  1. 1Access at http://localhost:3000
  2. 2Real-time markdown editing
  3. 3HackMD/CodiMD fork

Individual Services(2 services)

Copy individual services to mix and match with your existing compose files.

hedgedoc
hedgedoc:
  image: quay.io/hedgedoc/hedgedoc:latest
  container_name: hedgedoc
  restart: unless-stopped
  environment:
    CMD_DB_URL: postgres://hedgedoc:${DB_PASSWORD}@postgres:5432/hedgedoc
    CMD_DOMAIN: localhost
    CMD_URL_ADDPORT: "true"
  volumes:
    - hedgedoc_uploads:/hedgedoc/public/uploads
  ports:
    - "3000:3000"
  depends_on:
    - postgres
  networks:
    - hedgedoc
postgres
postgres:
  image: postgres:15-alpine
  container_name: hedgedoc-postgres
  restart: unless-stopped
  environment:
    POSTGRES_USER: hedgedoc
    POSTGRES_PASSWORD: ${DB_PASSWORD}
    POSTGRES_DB: hedgedoc
  volumes:
    - postgres_data:/var/lib/postgresql/data
  networks:
    - hedgedoc

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 hedgedoc:
5 image: quay.io/hedgedoc/hedgedoc:latest
6 container_name: hedgedoc
7 restart: unless-stopped
8 environment:
9 CMD_DB_URL: postgres://hedgedoc:${DB_PASSWORD}@postgres:5432/hedgedoc
10 CMD_DOMAIN: localhost
11 CMD_URL_ADDPORT: "true"
12 volumes:
13 - hedgedoc_uploads:/hedgedoc/public/uploads
14 ports:
15 - "3000:3000"
16 depends_on:
17 - postgres
18 networks:
19 - hedgedoc
20
21 postgres:
22 image: postgres:15-alpine
23 container_name: hedgedoc-postgres
24 restart: unless-stopped
25 environment:
26 POSTGRES_USER: hedgedoc
27 POSTGRES_PASSWORD: ${DB_PASSWORD}
28 POSTGRES_DB: hedgedoc
29 volumes:
30 - postgres_data:/var/lib/postgresql/data
31 networks:
32 - hedgedoc
33
34volumes:
35 hedgedoc_uploads:
36 postgres_data:
37
38networks:
39 hedgedoc:
40 driver: bridge
41EOF
42
43# 2. Create the .env file
44cat > .env << 'EOF'
45DB_PASSWORD=changeme
46EOF
47
48# 3. Start the services
49docker compose up -d
50
51# 4. View logs
52docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/hedgedoc/run | bash

Troubleshooting

  • Database connection failed: Ensure DB_PASSWORD environment variable matches between HedgeDoc and PostgreSQL containers
  • HedgeDoc shows 'Cannot connect to database': Verify postgres container is running and network connectivity using docker logs hedgedoc-postgres
  • Upload functionality not working: Check hedgedoc_uploads volume permissions and ensure sufficient disk space
  • Real-time collaboration not syncing: Verify WebSocket connections aren't blocked by firewalls or reverse proxies
  • PostgreSQL container fails to start: Check postgres_data volume permissions and ensure no conflicting database processes on host
  • HedgeDoc interface loads but documents won't save: Examine PostgreSQL logs for constraint violations or disk space issues

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Ad Space