Install BookStack Inside Docker Container in Linux

Install BookStack Inside Docker Container in Linux

BookStack is a web-based wiki application that can be used for organising and storing information. BookStack is an open-source project that released under the MIT license.

This tutorial explains how to install BookStack inside a Docker container in the Linux. Commands have been tested on Ubuntu.

Prepare environment

Make sure you have installed Docker in your system. If you are using Ubuntu, installation instructions can be found in the post.

You also need to have a running MySQL container. Instructions can be found in the post.

Install BookStack

Before starting, create bookstack database:

docker exec -it mysql mysql -u root -p -e "CREATE DATABASE bookstack"
  • Host network

Run the following command to create a container for BookStack that uses host network:

docker run -d --name=bookstack --restart=always --network=host \
    -v /opt/bookstack/config:/config \
    -e DB_USER=root \
    -e DB_PASS=pwd123 \
    -e DB_DATABASE=bookstack \
    -e DB_HOST=127.0.0.1 \
    -e APP_URL=http://192.168.0.252 \
    linuxserver/bookstack

MySQL container should run on host network as well.

  • User-defined bridge network

User-defined bridge network can be used for listening on different port. By default, BookStack service is listening on port 80. It can be changed with -p option.

docker network create app-net
docker run -d --name=bookstack --restart=always --network=app-net \
    -p 8080:80 \
    -v /opt/bookstack/config:/config \
    -e DB_USER=root \
    -e DB_PASS=pwd123 \
    -e DB_DATABASE=bookstack \
    -e DB_HOST=mysql \
    -e APP_URL=http://192.168.0.252:8080 \
    linuxserver/bookstack

MySQL container should run on the same user-defined bridge network as well.

Notes:

  • Don't forget to change IP address or URL for BookStack application using APP_URL.
  • The DB_USER and DB_PASS can be used to specify MySQL credentials.
  • When user-defined bridge network is used, don't forget to change DB_HOST. It specifies MySQL container name.

Testing BookStack

Open a web browser and go to http://<IP_ADDRESS>, where <IP_ADDRESS> is the IP address of the system. Log in to the dashboard with the default email (admin@admin.com) and password (password).

BookStack Inside Docker Container in Linux

Uninstall BookStack

To completely remove BookStack, remove its container:

docker rm --force bookstack

Remove BookStack image:

docker rmi linuxserver/bookstack

You can also remove BookStack data:

sudo rm -rf /opt/bookstack

If a user-defined bridge network was created, you can delete it as follows:

docker network rm app-net

Leave a Comment

Cancel reply

Your email address will not be published.