docker.recipes

Wiki.js with PostgreSQL

beginner

Powerful and extensible open source wiki with modern interface.

Overview

Wiki.js is a modern, lightweight, and powerful wiki engine built on Node.js that provides a clean, intuitive interface for creating and managing documentation. Originally created by Nicolas Giard, Wiki.js has become one of the most popular self-hosted wiki solutions, offering features like real-time collaboration, Git synchronization, advanced search capabilities, and support for multiple authentication providers. Unlike traditional wikis with dated interfaces, Wiki.js provides a contemporary editing experience with support for Markdown, visual editing, and extensible functionality through modules. This deployment combines Wiki.js with PostgreSQL as the database backend, creating a robust two-service architecture. The wikijs container runs the main application on port 3000, while the dedicated db container provides PostgreSQL 15 Alpine for data persistence. The services communicate over a private Docker network, with Wiki.js configured to connect to PostgreSQL using environment variables for database credentials and connection details. Both containers use persistent volumes to ensure data survives container restarts and updates. This configuration is ideal for organizations and individuals who need a reliable, feature-rich wiki solution with enterprise-grade database capabilities. PostgreSQL's advanced features like full-text search, JSON support, and ACID compliance make it an excellent choice for Wiki.js deployments that expect growth, complex content structures, or integration with existing PostgreSQL infrastructure. The combination provides excellent performance, data integrity, and scalability compared to lighter database options.

Key Features

  • Modern visual editor with live preview alongside traditional Markdown support
  • Git synchronization for version control and backup of wiki content
  • Advanced full-text search powered by PostgreSQL's search capabilities
  • Multiple authentication providers including LDAP, OAuth, and SAML
  • Page hierarchy and navigation with automatic breadcrumbs and tree structure
  • Real-time collaborative editing with conflict resolution
  • Asset management for images, documents, and media files
  • Extensible module system for custom functionality and integrations

Common Use Cases

  • 1Corporate knowledge bases and internal documentation for growing teams
  • 2Technical documentation for software projects with Git workflow integration
  • 3Educational institutions managing course materials and collaborative research
  • 4Open source projects requiring professional documentation sites
  • 5IT departments creating runbooks, procedures, and system documentation
  • 6Startups building internal wikis that need to scale with company growth
  • 7Personal knowledge management for researchers and content creators

Prerequisites

  • Docker and Docker Compose installed on the host system
  • Minimum 1GB RAM available (512MB for Wiki.js, 512MB for PostgreSQL)
  • Port 3000 available for Wiki.js web interface access
  • Environment variable DB_PASSWORD configured for database authentication
  • Basic understanding of wiki markup and Markdown syntax
  • Approximately 2GB disk space for initial installation and content growth

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 wikijs:
3 image: ghcr.io/requarks/wiki:2
4 container_name: wikijs
5 environment:
6 - DB_TYPE=postgres
7 - DB_HOST=db
8 - DB_PORT=5432
9 - DB_USER=wiki
10 - DB_PASS=${DB_PASSWORD}
11 - DB_NAME=wiki
12 volumes:
13 - wikijs-data:/wiki/data
14 ports:
15 - "3000:3000"
16 depends_on:
17 - db
18 networks:
19 - wikijs-network
20 restart: unless-stopped
21
22 db:
23 image: postgres:15-alpine
24 container_name: wikijs-db
25 environment:
26 - POSTGRES_USER=wiki
27 - POSTGRES_PASSWORD=${DB_PASSWORD}
28 - POSTGRES_DB=wiki
29 volumes:
30 - postgres-data:/var/lib/postgresql/data
31 networks:
32 - wikijs-network
33 restart: unless-stopped
34
35volumes:
36 wikijs-data:
37 postgres-data:
38
39networks:
40 wikijs-network:
41 driver: bridge

.env Template

.env
1# Wiki.js
2DB_PASSWORD=secure_wiki_password

Usage Notes

  1. 1Web UI at http://localhost:3000
  2. 2Complete setup wizard on first visit
  3. 3Supports Markdown, HTML, visual editor
  4. 4Git sync, search, and analytics
  5. 5Multiple auth providers supported

Individual Services(2 services)

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

wikijs
wikijs:
  image: ghcr.io/requarks/wiki:2
  container_name: wikijs
  environment:
    - DB_TYPE=postgres
    - DB_HOST=db
    - DB_PORT=5432
    - DB_USER=wiki
    - DB_PASS=${DB_PASSWORD}
    - DB_NAME=wiki
  volumes:
    - wikijs-data:/wiki/data
  ports:
    - "3000:3000"
  depends_on:
    - db
  networks:
    - wikijs-network
  restart: unless-stopped
db
db:
  image: postgres:15-alpine
  container_name: wikijs-db
  environment:
    - POSTGRES_USER=wiki
    - POSTGRES_PASSWORD=${DB_PASSWORD}
    - POSTGRES_DB=wiki
  volumes:
    - postgres-data:/var/lib/postgresql/data
  networks:
    - wikijs-network
  restart: unless-stopped

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 wikijs:
5 image: ghcr.io/requarks/wiki:2
6 container_name: wikijs
7 environment:
8 - DB_TYPE=postgres
9 - DB_HOST=db
10 - DB_PORT=5432
11 - DB_USER=wiki
12 - DB_PASS=${DB_PASSWORD}
13 - DB_NAME=wiki
14 volumes:
15 - wikijs-data:/wiki/data
16 ports:
17 - "3000:3000"
18 depends_on:
19 - db
20 networks:
21 - wikijs-network
22 restart: unless-stopped
23
24 db:
25 image: postgres:15-alpine
26 container_name: wikijs-db
27 environment:
28 - POSTGRES_USER=wiki
29 - POSTGRES_PASSWORD=${DB_PASSWORD}
30 - POSTGRES_DB=wiki
31 volumes:
32 - postgres-data:/var/lib/postgresql/data
33 networks:
34 - wikijs-network
35 restart: unless-stopped
36
37volumes:
38 wikijs-data:
39 postgres-data:
40
41networks:
42 wikijs-network:
43 driver: bridge
44EOF
45
46# 2. Create the .env file
47cat > .env << 'EOF'
48# Wiki.js
49DB_PASSWORD=secure_wiki_password
50EOF
51
52# 3. Start the services
53docker compose up -d
54
55# 4. View logs
56docker 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/wikijs-complete/run | bash

Troubleshooting

  • Wiki.js shows database connection error: Verify DB_PASSWORD environment variable matches between wikijs and db services
  • Setup wizard not accessible at localhost:3000: Check that port 3000 is not blocked by firewall or used by another service
  • PostgreSQL container fails to start with data directory error: Ensure postgres-data volume has proper permissions or remove volume to reset
  • Wiki.js container restarts continuously: Check logs with 'docker logs wikijs' and verify all required environment variables are set
  • Git sync fails during Wiki.js operation: Ensure Wiki.js container has network access and valid Git credentials configured in admin panel
  • Search functionality not working properly: Restart wikijs container to rebuild search indices after PostgreSQL connection 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