Skip to content

Instantly share code, notes, and snippets.

@diegofcornejo
Last active March 21, 2025 17:29
Show Gist options
  • Save diegofcornejo/25501ea5f216c19dc41bdfd50d5b4df9 to your computer and use it in GitHub Desktop.
Save diegofcornejo/25501ea5f216c19dc41bdfd50d5b4df9 to your computer and use it in GitHub Desktop.
BookStack Docker Compose
name: bookstack
services:
# The container for BookStack itself
bookstack:
# You should update the version here to match the latest
# release of BookStack: https://github.com/BookStackApp/BookStack/releases
# You'll change this when wanting to update the version of BookStack used.
image: lscr.io/linuxserver/bookstack:version-v25.02
container_name: bookstack
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
# APP_URL must be set as the base URL you'd expect to access BookStack
# on via the browser. The default shown here is what you might use if accessing
# direct from the browser on the docker host, hence the use of the port as configured below.
- APP_URL=${APP_URL}
# APP_KEY must be a unique key. Generate your own by running
# docker run -it --rm --entrypoint /bin/bash lscr.io/linuxserver/bookstack:latest appkey
# You should keep the "base64:" part for the option value.
- APP_KEY=${APP_KEY}
# The below database details are purposefully aligned with those
# configuted for the "mariadb" service below:
- DB_HOST=${DB_HOST}
- DB_PORT=${DB_PORT}
- DB_DATABASE=${DB_DATABASE}
- DB_USERNAME=${DB_USERNAME}
- DB_PASSWORD=${DB_PASSWORD}
# Mail
- MAIL_DRIVER=${MAIL_DRIVER}
- MAIL_HOST=${MAIL_HOST}
- MAIL_PORT=${MAIL_PORT}
- MAIL_ENCRYPTION=${MAIL_ENCRYPTION}
- MAIL_USERNAME=${MAIL_USERNAME}
- MAIL_PASSWORD=${MAIL_PASSWORD}
- MAIL_FROM=${MAIL_FROM}
- MAIL_FROM_NAME=${MAIL_FROM_NAME}
volumes:
# You generally only ever need to map this one volume.
# This maps it to a "bookstack_app_data" folder in the same
# directory as this compose config file.
- ./bookstack_app_data:/config
ports:
# This exposes port 6875 for general web access.
# Commonly you'd have a reverse proxy in front of this,
# redirecting incoming requests to this port.
- ${APP_PORT}:80
restart: unless-stopped
# The container for the database which BookStack will use to store
# most of its core data/content.
mariadb:
# You should update the version here to match the latest
# main version of the linuxserver mariadb container version:
# https://github.com/linuxserver/docker-mariadb/pkgs/container/mariadb/versions?filters%5Bversion_type%5D=tagged
image: lscr.io/linuxserver/mariadb:11.4.5
container_name: bookstack-db
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
# You may want to change the credentials used below,
# but be aware the latter three options need to align
# with the DB_* options for the BookStack container.
- MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
- MYSQL_DATABASE=${DB_DATABASE}
- MYSQL_USER=${DB_USERNAME}
- MYSQL_PASSWORD=${DB_PASSWORD}
volumes:
# You generally only ever need to map this one volume.
# This maps it to a "bookstack_db_data" folder in the same
# directory as this compose config file.
- ./bookstack_db_data:/config
# These ports are commented out as you don't really need this port
# exposed for normal use, mainly only if connecting direct the the
# database externally. Otherwise, this risks exposing access to the
# database when not needed.
# ports:
# - 3306:3306
restart: unless-stopped
# Database
DB_ROOT_PASSWORD=<DB_ROOT_PASSWORD>
DB_HOST=mariadb
DB_PORT=3306
DB_DATABASE=bookstack
DB_USERNAME=bookstack
DB_PASSWORD=<DB_PASSWORD>
# App
APP_PORT=3000
APP_URL=http://localhost:3000
APP_KEY=<APP_KEY> # docker run -it --rm --entrypoint /bin/bash lscr.io/linuxserver/bookstack:latest appkey
# Mail
MAIL_DRIVER=smtp
# SMTP server host address
MAIL_HOST=email-smtp.us-east-1.amazonaws.com
# SMTP server port
# Using port 465 will force connections to be via TLS
MAIL_PORT=587
# Connection encryption to use
# Valid values are: tls, null
# Using 'tls' will require either TLS or STARTTLS to be used.
# When using 'null' STARTTLS will still be attempted if announced
# as supported by your SMTP server.
# Using port 465 above will force connections to be via TLS.
MAIL_ENCRYPTION=tls
# Authentication details for your SMTP service
MAIL_USERNAME=<AWS_SMTP_USERNAME> # AWS ACCESS KEY
MAIL_PASSWORD=<AWS_SMTP_PASSWORD> # AWS SECRET ACCESS KEY
# The "from" email address for outgoing email
MAIL_FROM=<EMAIL_FROM>
# The "from" name used for outgoing email
MAIL_FROM_NAME=<EMAIL_FROM_NAME>
# You can login using the default admin details [email protected] with a password of password. You should change these details immediately after logging in for the first time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment