Set Up Bookstack as an Open Source Knowledge Base with Docker
Install Bookstack, a powerful open-source knowledge base, easily and efficiently on your own server using Docker and Docker Compose.

Table of Contents
Sometimes you just want to organize your knowledge. Scattered notes, countless bookmarks, configuration snippets, or parts of documentation can get lost somewhere on your hard drive. What if you had a central, private knowledge base that was easy to use and manage?
I’ll show you step-by-step how to install Bookstack, a powerful open-source wiki software, on your own server. And, of course, we’ll do it the easy and efficient way with Docker and Docker Compose. By the end, you’ll have your own organized knowledge base up and running, ready to be customized and expanded as you see fit.
Bookstack is an open-source knowledge base designed specifically to store information in a structured and user-friendly way. The platform allows users to organize content into Books, Chapters, and Pages, which promotes intuitive navigation and makes finding information simple. It’s particularly well-suited for teams and organizations that need a central hub for their knowledge, but it’s also an excellent tool for personal projects.
Why Choose an Open-Source Solution Like Bookstack?
Opting for an open-source solution like Bookstack comes with numerous advantages. First and foremost, the open source code allows users to customize the software to their specific needs. Unlike proprietary software solutions, you’re not tied to a vendor’s roadmap.
Another significant benefit is community support. Bookstack has an active developer and user community that regularly provides updates and responds to security vulnerabilities. Additionally, there are no high licensing fees, which is a major advantage for small businesses, teams, or individuals.
Key Takeaways
- Bookstack is an open-source knowledge base for structured knowledge organization.
- With Docker and Docker Compose, Bookstack can be installed easily, quickly, and platform-independently.
- The hierarchical structure (Books > Chapters > Pages) ensures excellent clarity.
- Features like a Markdown editor, version control, and a powerful search make it a potent tool.
- Self-hosting gives you full control over your data.
Prerequisites
Before we get started, make sure you have the following:
- A Server: This can be a small VPS (e.g., from Hetzner Affiliate Link), a local server like a Raspberry Pi, or even a Synology NAS or Ugreen NAS Affiliate Link. A Linux operating system (like Ubuntu 24.04) is ideal.
- Docker and Docker Compose: These must be installed on your server. Most server setups can be quickly equipped with them nowadays.
- (Optional) A Domain: If you want to access Bookstack later via an easy-to-remember address (e.g.,
wiki.yourdomain.com
) with an SSL certificate, you’ll need a domain that points to your server’s IP address.
Step-by-Step Guide: Installation with Docker Compose
We will run Bookstack along with a MariaDB database in a Docker setup. This ensures that all components are cleanly separated and easy to manage.
1. Create the Directory Structure
Connect to your server via SSH and create a directory for your Bookstack project. We will store all necessary configuration files and data in this folder.
# Create the main directory and navigate into it
mkdir ~/bookstack
cd ~/bookstack
# Create subfolders for configuration and database data
mkdir config db
2. Find Your User and Group ID
To allow the Docker container to access our folders with the correct permissions, we need the ID of your current user.
id
The output will look something like this: uid=1000(youruser) gid=1000(youruser) groups=1000(youruser)
. Take note of the numbers for uid
(PUID) and gid
(PGID). In most cases, both will be 1000
.
3. Create the Docker Compose File
Now, create the central configuration file compose.yaml
(or docker-compose.yml
) in the bookstack
directory:
nano compose.yaml
Paste the following content. Be sure to adapt the marked sections to your environment.
services:
bookstack:
image: lscr.io/linuxserver/bookstack:25.07.2 # Use a specific version instead of 'latest'
container_name: bookstack
restart: unless-stopped
environment:
- PUID=1000 # ENTER YOUR USER ID HERE
- PGID=1000 # ENTER YOUR GROUP ID HERE
- TZ=Europe/Berlin # Your time zone
- APP_URL=http://YOUR_SERVER_IP:6875 # URL where Bookstack will be accessible
- APP_KEY=YOUR_SECURE_APP_KEY # Will be generated in the next step
- DB_HOST=bookstack_db
- DB_PORT=3306
- DB_USER=bookstack
- DB_PASS=YOUR_SECURE_DB_PASSWORD # Choose a secure password
- DB_DATABASE=bookstack
volumes:
- ./config:/config
ports:
- "6875:80" # Port on the host (left) to port in the container (right)
depends_on:
- bookstack_db
networks:
- internal
# MariaDB Database Service
bookstack_db:
image: mariadb:11
container_name: bookstack_db
restart: unless-stopped
environment:
- MARIADB_ROOT_PASSWORD=YOUR_SECURE_ROOT_PASSWORD # Choose a secure root password
- MARIADB_DATABASE=bookstack
- MARIADB_USER=bookstack
- MARIADB_PASSWORD=YOUR_SECURE_DB_PASSWORD # The same password as above
volumes:
- ./db:/var/lib/mysql
networks:
- internal
networks:
internal:
external: false
Important Adjustments:
PUID
&PGID
: Replace1000
with the values you obtained from theid
command.APP_URL
: ReplaceYOUR_SERVER_IP
with your server’s public IP address. The port6875
must match the port you define on the left side underports
.- Passwords: Choose secure and unique passwords for
DB_PASS
andMARIADB_ROOT_PASSWORD
. APP_KEY
: We will generate this now.
4. Generate the App Key
Bookstack requires a unique key for encryption. Run the following command to generate one. It uses the Bookstack Docker image to execute the command without permanently starting the container.
sudo docker run -it --rm --entrypoint /bin/bash lscr.io/linuxserver/bookstack:latest appkey
Copy the value that appears after APP_KEY=
(e.g., base64:xxxxxxxx...
) and paste it into your compose.yaml
file.
5. Start Bookstack
Everything is now prepared. Start the containers with the following command in the bookstack
directory:
sudo docker compose up -d
Docker will now download the required images and start the containers in the background. This may take a few minutes the first time. You can monitor the startup process and check for any errors with sudo docker compose logs -f
.
Initial Setup and Configuration
If everything went well, your Bookstack instance is now accessible!
- Open your web browser and navigate to the address you specified in the
APP_URL
(e.g.,http://YOUR_SERVER_IP:6875
). - You should see the Bookstack login page. Log in with the default credentials:
- Username:
admin@admin.com
- Password:
password
- Username:
- Change your password immediately! Click on your profile picture in the top right corner, go to “Edit Profile,” and set a new, secure password.
First Steps in Bookstack
The user interface is self-explanatory. You can start organizing your knowledge right away:
- Shelves: Group together thematically related books.
- Books: The main organizational element for a topic or project.
- Chapters: Optional subdivisions within a book.
- Pages: This is where you write the actual content. The editor supports both Markdown and a WYSIWYG mode.
Updating Bookstack
One of the great advantages of Docker is the ease of updating. To update Bookstack, follow these steps:
- Find the new version: Check the GitHub page of the linuxserver/bookstack-image for the latest available tag.
- Adapt
compose.yaml
: Change the image tag in yourcompose.yaml
file to the new version. - Pull the new image: Download the new image.
sudo docker compose pull
- Recreate the containers: Restart the containers. Docker Compose will detect the change and recreate the Bookstack container with the new image, while your data is preserved.
sudo docker compose up -d
- (Optional) Clean up old images: To free up disk space, you can delete unused Docker images.
sudo docker image prune
FAQs
What is Bookstack and why is it a good choice for a knowledge base?
Bookstack is an open-source software that allows users to create and manage knowledge bases. It offers a user-friendly interface to organize content in a hierarchical structure (Shelves > Books > Chapters > Pages). It is particularly well-suited for teams and organizations that want to centralize their knowledge and make it easily accessible.
How secure is Bookstack?
As a self-hosted application, you have full control over security. Bookstack provides granular user and role management to control access. If you run it behind a reverse proxy, the connection is encrypted via HTTPS. Regular updates to the software and the server are crucial for security.
Can I export my data from Bookstack?
Yes, Bookstack offers various export options. You can export individual pages as PDF, HTML, or plain text. Entire books can also be exported. This ensures that you are not locked into the platform.
What features does Bookstack offer for collaboration?
Bookstack supports multiple users with different roles (e.g., Admin, Editor, Viewer). Pages can be commented on, and the version history of each page allows you to track changes and restore previous versions if necessary.
How can I integrate Bookstack with other systems?
Bookstack provides a REST API that allows interaction with other systems. This enables you to programmatically create, read, or update content. There are also webhook integrations to notify other services about events in Bookstack.