Home > Software > How to Deploy Bookstack with Docker Compose

How to Deploy Bookstack with Docker Compose

Anastasios Antoniadis

Learn how to deploy BookStack with Docker Compose using our straightforward guide. Simplify the setup of this open-source wiki platform, making knowledge management and collaboration easier and more organized for teams and individuals.

Docker (1)

BookStack is a free and open-source platform designed to provide users with a simple, self-hosted, easy-to-use platform for organizing and storing information. It is perfect for individuals and teams looking for a wiki or documentation platform that combines the usability of a wiki with the organizational capabilities of a book. Deploying BookStack using Docker Compose streamlines the setup process, making it accessible for users to establish their own knowledge management system efficiently. This guide will walk you through the steps to deploy BookStack using Docker Compose.

Prerequisites

Before you begin, ensure you have the following:

  • Docker installed on your system.
  • Docker Compose installed on your system.
  • Basic understanding of Docker concepts and the YAML syntax used in Docker Compose files.

Step 1: Create a Docker Compose File

Create a directory dedicated to your BookStack setup. This directory will contain your Docker Compose file (docker-compose.yml) and any additional configuration files or directories you might need.

mkdir bookstack-docker && cd bookstack-docker

Create the docker-compose.yml file:

touch docker-compose.yml

Open this file in a text editor and insert the following configuration:

version: '3.8'
services:
  bookstack:
    image: solidnerd/bookstack:latest
    container_name: bookstack
    environment:
      - DB_HOST=db
      - DB_DATABASE=bookstack
      - DB_USERNAME=bookstack
      - DB_PASSWORD=secret
    depends_on:
      - db
    ports:
      - "8080:80"
    restart: always

  db:
    image: mysql:5.7
    container_name: bookstack_db
    environment:
      - MYSQL_ROOT_PASSWORD=secret
      - MYSQL_DATABASE=bookstack
      - MYSQL_USER=bookstack
      - MYSQL_PASSWORD=secret
    volumes:
      - db_data:/var/lib/mysql
    restart: always

volumes:
  db_data:

Configuration Explained:

  • bookstack: Defines the BookStack service using the solidnerd/bookstack Docker image. It sets environment variables for connecting to the database and maps port 8080 on the host to port 80 in the container.
  • db: Sets up a MySQL database for BookStack. Environment variables are defined to configure the database credentials and a volume is used to persist the database data.
  • volumes: Declares a named volume (db_data) for the database, ensuring that your data is retained across container restarts.
  • restart: Ensures both the BookStack and database containers restart automatically unless explicitly stopped.

Step 2: Launch BookStack

Navigate to the directory containing your docker-compose.yml file and start BookStack and its database by running:

docker compose up -d

This command will download the necessary Docker images and start the BookStack and MySQL containers in detached mode.

Step 3: Access BookStack

Once the containers are up and running, you can access the BookStack web interface by navigating to http://localhost:8080 in your web browser. Upon first access, you will be directed to the login page. The default credentials are usually [email protected] for the username and password for the password, this can depend on the specific Docker image or if the credentials were changed in the environment variables.

Conclusion

Deploying BookStack with Docker Compose offers an efficient and straightforward method for building a robust knowledge management system. Following the steps outlined in this guide, you can quickly have a BookStack instance running on your own server, ready to organize and store valuable information. Docker Compose simplifies the management of BookStack services, making it easy to maintain, backup, and upgrade your setup. Whether for personal use, team collaboration, or organizational knowledge sharing, BookStack provides a comprehensive solution for managing and accessing information in a structured, user-friendly manner.

Anastasios Antoniadis
Follow me
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x