BookStack with Docker Compose
BookStack is a simple, open-source, self-hosted, easy-to-use platform for organising and storing information. In the project's words: bookstackapp.com front page checked 2026-09-25
Runs on: amd64, arm64 from each image's registry manifest, checked 2026-09-25; a CPU counts only if every image has a build for it. Image by image
Add BookStack to the builder to use your own domain, get its passwords generated in your browser, and combine it with other apps in one file.
What BookStack needs
Only figures BookStack's own documentation publishes, each linked to the page it is on. Where the project gives no number, this page does not invent one.
| Resource | Minimum | Recommended |
|---|---|---|
| RAM | The project publishes no figure | |
| CPU | The project publishes no figure | |
| Disk | The project publishes no figure | |
Which hardware BookStack has images for
Read from each image's manifest list in its registry (anonymous, read-only) when this page was built. An app counts for a CPU only if every one of its images lists it.
- x86-64 PC or NAS (
linux/amd64): every image has a build. - Raspberry Pi 4/5, 64-bit OS (
linux/arm64): every image has a build. - Raspberry Pi 3 or Zero 2 W, 32-bit OS (
linux/arm/v7): no image forbookstack,mariadb. No image for this hardware; the builder leaves the app out.
| Service | Image | Platforms in the manifest | Digest | Registry | Checked |
|---|---|---|---|---|---|
bookstack | lscr.io/linuxserver/bookstack:version-v26.03.3 | amd64, arm64 | sha256:123be84437ee5e9dd4b36466f1812a3ba9b99ed31b3b451702f2dd09f5fc36c1 | lscr.io | 2026-09-25 |
mariadb | lscr.io/linuxserver/mariadb:11.4.9 | amd64, arm64 | sha256:8ea7a10e36dfe229cd4f91a12fb2c8ac40bd0c4b2276e472de8f7835aa360fcd | lscr.io | 2026-09-25 |
docker-compose.yml
This is exactly what the builder writes for BookStack alone on example.org: the official definition with its published ports removed and Caddy added in front. The time zone is Etc/UTC here; the builder uses your browser's. Every ${VARIABLE} is defined in the .env below.
# docker-compose.yml built at dankhost.com for: BookStack # Each app block is its official compose definition. Only the names were prefixed with # the app slug (services, containers, volumes, bind folders, .env variables) so any set of # apps can share one file; other differences are listed under "Changed:" in each block. # Only Caddy publishes ports. Secrets live in .env next to this file. services: # ---- Caddy: the one reverse proxy, HTTPS certificates from Let's Encrypt ---- # Source: https://caddyserver.com/docs/running (checked 2026-09-23) # Source: https://github.com/dani-garcia/vaultwarden/wiki/Using-Docker-Compose (checked 2026-09-23) # Caddyfile goes in ./caddy/Caddyfile. Fixed address 172.30.0.2 so apps can trust it exactly. caddy: image: "caddy:2" container_name: "caddy" restart: "unless-stopped" ports: - "80:80" - "443:443" - "443:443/udp" volumes: - "./caddy:/etc/caddy" - "caddy-data:/data" - "caddy-config:/config" networks: proxy: ipv4_address: "172.30.0.2" # ---- BookStack (bookstack.example.org) ---- # Source: https://www.bookstackapp.com/docs/admin/installation/ (checked 2026-09-25) # Source: https://codeberg.org/bookstack/devops/src/branch/main/config/lsio-docker/docker-compose.yml (checked 2026-09-25) # Changed: Removed the '6875:80' port; Caddy reaches bookstack:80 on the proxy network. The documented container names bookstack and bookstack_mariadb become the builder's (bookstack, bookstack-mariadb). # APP_URL is your https address instead of the example's localhost address on port 6875; the file says it must be the base URL you reach BookStack on in the browser. # APP_KEY, the database password (used in both DB_PASSWORD and MYSQL_PASSWORD, which the file says must match) and the root password are generated instead of the example values. APP_KEY is 32 random letters and digits: Laravel takes a 32-character key as it is, and the 'base64:' prefix is only for a base64-encoded one. # TZ is your time zone instead of Etc/UTC. bookstack: image: "lscr.io/linuxserver/bookstack:version-v26.03.3" container_name: "bookstack" environment: PUID: "1000" PGID: "1000" TZ: "Etc/UTC" APP_URL: "https://bookstack.example.org" APP_KEY: "${BOOKSTACK_APP_KEY}" DB_HOST: "mariadb" DB_PORT: "3306" DB_DATABASE: "bookstack" DB_USERNAME: "bookstack" DB_PASSWORD: "${BOOKSTACK_DB_PASSWORD}" volumes: - "./bookstack/bookstack_app_data:/config" restart: "unless-stopped" networks: proxy: {} bookstack-backend: {} bookstack-mariadb: image: "lscr.io/linuxserver/mariadb:11.4.9" container_name: "bookstack-mariadb" environment: PUID: "1000" PGID: "1000" TZ: "Etc/UTC" MYSQL_ROOT_PASSWORD: "${BOOKSTACK_DB_ROOT_PASSWORD}" MYSQL_DATABASE: "bookstack" MYSQL_USER: "bookstack" MYSQL_PASSWORD: "${BOOKSTACK_DB_PASSWORD}" volumes: - "./bookstack/bookstack_db_data:/config" restart: "unless-stopped" networks: bookstack-backend: aliases: - "mariadb" networks: # Pinned so the trusted-proxy address given to each app (172.30.0.2) is exact. # If "docker compose up" reports "Pool overlaps", change 172.30.0 here, in Caddy's # ipv4_address and in every trusted-proxy value to a free 172.x.0 range. proxy: ipam: config: - subnet: "172.30.0.0/24" ip_range: "172.30.0.128/25" gateway: "172.30.0.1" bookstack-backend: internal: true volumes: caddy-data: caddy-config:
Caddyfile save as caddy/Caddyfile
Caddy gets and renews the HTTPS certificate for bookstack.example.org by itself once the DNS record points at your server and ports 80 and 443 reach it.
# Caddyfile built at dankhost.com. Save it as ./caddy/Caddyfile next to docker-compose.yml.
# Caddy gets and renews a Let's Encrypt certificate for each name below by itself,
# once the DNS records point at this server and ports 80 and 443 reach it.
# BookStack
bookstack.example.org {
reverse_proxy bookstack:80
}
.env
The secrets are left blank here on purpose: a password printed on a public page is the same for everyone who copies it. The builder fills them with random letters and digits made in your browser.
# .env for BookStack, from dankhost.com/app/bookstack/. Fill the blank secrets before starting. # Keep this file private (chmod 600). # BookStack # 32 random letters and digits: the builder fills this in your browser BOOKSTACK_APP_KEY= # 32 random letters and digits: the builder fills this in your browser BOOKSTACK_DB_PASSWORD= # 32 random letters and digits: the builder fills this in your browser BOOKSTACK_DB_ROOT_PASSWORD=
Changes from the official file
Besides prefixing every service, container, volume, folder and variable with bookstack (so any set of apps can share one file), these are all the differences from what the project documents:
- Removed the '6875:80' port; Caddy reaches bookstack:80 on the proxy network. The documented container names bookstack and bookstack_mariadb become the builder's (bookstack, bookstack-mariadb).
- APP_URL is your https address instead of the example's localhost address on port 6875; the file says it must be the base URL you reach BookStack on in the browser.
- APP_KEY, the database password (used in both DB_PASSWORD and MYSQL_PASSWORD, which the file says must match) and the root password are generated instead of the example values. APP_KEY is 32 random letters and digits: Laravel takes a 32-character key as it is, and the 'base64:' prefix is only for a base64-encoded one.
- TZ is your time zone instead of Etc/UTC.
Notes for BookStack behind the proxy
- BookStack's installation page lists this LinuxServer.io setup under community Docker containers: the images are maintained by LinuxServer.io, not by the BookStack project.
- Log in at https://bookstack.example.org with BookStack's default admin account, admin@admin.com / password, and change both at once.
- Update by changing the version in the image tag (version-v26.03.3) to the latest BookStack release, as the file's comment says.
How to run it
- At your DNS provider, add an A record named
bookstackon your domain pointing at the server's public IP address, and forward TCP 80, TCP 443 and UDP 443 to it. - Save the three files in one folder:
docker-compose.ymland.envside by side, the Caddyfile at./caddy/Caddyfile. Replaceexample.orgwith your domain in the Caddyfile, the compose file and the .env, or let the builder do it. - Fill the blank
BOOKSTACK_APP_KEY,BOOKSTACK_DB_PASSWORD,BOOKSTACK_DB_ROOT_PASSWORDin.env. The builder generates them; on the server,tr -dc A-Za-z0-9 </dev/urandom | head -c 32prints 32 random letters and digits. Thenchmod 600 .env. - Start it:
docker compose up -d docker compose logs -f caddy # watch the certificate arrive
- Open the new address (
bookstack.plus your domain) in a browser and follow the notes above.
Back it up
BookStack's backup page names two things: the database, saved with mysqldump, and the files (.env, public/uploads, storage/uploads, themes). In the LinuxServer.io image all of those live under /config, which is ./bookstack_app_data here.
Below is the BACKUP.md the builder writes next to the compose file above: which of its folders and volumes hold data, the dump command the project documents, rewritten for this file's service names, what to copy with which container stopped, and a restore check. Pick more apps in the builder and it covers them all in one file.
# BACKUP.md built at dankhost.com for: BookStack
What to copy from the docker-compose.yml built with this file, the database dump each project documents (rewritten for the service names in that file), what to copy with which container stopped, and how to check the result. Run every command in the folder that holds docker-compose.yml.
The folders are owned by the containers' users: put sudo in front of tar if it says "Permission denied". Named volumes live under /var/lib/docker/volumes, not next to the compose file, so they are copied through a throwaway ubuntu container (Docker's documented --volumes-from method). tar makes a full copy each run; for large folders an incremental tool (restic, borg, rsync) saves time and space.
Never run "docker compose down -v" on this file: it deletes the named volumes of every app in it.
## Before you start
BACKUP=/mnt/backup/selfhost # change this: a disk or machine other than this server's system disk
mkdir -p "$BACKUP"
## Every time: the three stack files
tar czf "$BACKUP/stack-files.tar.gz" docker-compose.yml .env caddy
.env holds the database passwords and secret keys the apps were set up with; keep this archive as private as the data.
## Caddy (the reverse proxy)
Caddy's docs: 'The data directory must not be treated as a cache.' It holds the TLS certificates and their private keys; without it Caddy has to ask Let's Encrypt for every certificate again.
- caddy-data (named volume, /data in caddy)
BACK UP: TLS certificates, private keys, OCSP staples.
- caddy-config (named volume, /config in caddy)
SKIP: the last active configuration, kept for 'caddy run --resume', which this setup does not use: it starts from the Caddyfile.
- ./caddy (/etc/caddy in caddy)
IN stack-files.tar.gz: the Caddyfile, copied with the stack files above.
Copy (Caddy keeps serving while you copy):
docker run --rm --volumes-from caddy -v "$BACKUP":/backup ubuntu tar cvf /backup/caddy-data.tar /data
Restore check:
tar tf "$BACKUP/caddy-data.tar" > /dev/null && echo OK
docker run --rm --volumes-from caddy -v "$BACKUP":/backup ubuntu bash -c "cd /data && tar xvf /backup/caddy-data.tar --strip 1"
Sources:
- Caddy docs: Conventions, Data directory: https://caddyserver.com/docs/conventions#data-directory (checked 2026-09-24)
- Docker docs: Volumes, Back up, restore, or migrate data volumes: https://docs.docker.com/engine/storage/volumes/#back-up-restore-or-migrate-data-volumes (checked 2026-09-24)
## BookStack
BookStack's backup page names two things: the database, saved with mysqldump, and the files (.env, public/uploads, storage/uploads, themes). In the LinuxServer.io image all of those live under /config, which is ./bookstack_app_data here.
What this compose mounts:
- ./bookstack/bookstack_app_data (/config in bookstack)
BACK UP: BookStack's /config: its .env (with APP_KEY), uploaded images, page attachments and themes.
- ./bookstack/bookstack_db_data (/config in bookstack-mariadb)
COVERED BY THE COMMAND BELOW: MariaDB data files; copy them only with the database stopped.
1. Stop bookstack. Stopping BookStack (not MariaDB) keeps page edits and uploads from arriving between the dump and the copy.
docker compose stop bookstack
2. Database dump for bookstack-mariadb:
docker compose exec -T bookstack-mariadb sh -c 'mariadb-dump -u "$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE"' > "$BACKUP/bookstack.backup.sql"
The backup page gives mysqldump -u {mysql_user} -p {database_name} > bookstack.backup.sql. In the LinuxServer.io MariaDB image the tool is mariadb-dump, MariaDB's name for mysqldump; it runs inside the database container, which already has the user, password and database name in its environment.
3. Copy while bookstack is stopped:
tar czf "$BACKUP/bookstack-bookstack_app_data.tar.gz" ./bookstack/bookstack_app_data
4. Start it again:
docker compose start bookstack
Restore check:
grep -c 'Dump completed' "$BACKUP/bookstack.backup.sql" # 1 means mariadb-dump finished
tar tzf "$BACKUP/bookstack-bookstack_app_data.tar.gz" > /dev/null && echo OK
Put a copy back (with bookstack stopped):
tar xzf "$BACKUP/bookstack-bookstack_app_data.tar.gz" # recreates ./bookstack/bookstack_app_data; move the old folder aside first
The backup page restores the database with mysql -u {mysql_user} -p {database_name} < {backup_file_name}, then puts the files back. With this file's names:
docker compose up -d bookstack-mariadb
docker compose exec -T bookstack-mariadb sh -c 'mariadb -u "$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE"' < "$BACKUP/bookstack.backup.sql"
docker compose up -d
Sources:
- BookStack docs: Backup and Restore (mysqldump; uploads, attachments, themes, .env): https://www.bookstackapp.com/docs/admin/backup-restore/ (checked 2026-09-25)
- MariaDB docs: mariadb-dump (formerly mysqldump): https://mariadb.com/docs/server/clients-and-utilities/backup-restore-and-import-clients/mariadb-dump (checked 2026-09-25)
- Docker docs: Volumes, Back up, restore, or migrate data volumes: https://docs.docker.com/engine/storage/volumes/#back-up-restore-or-migrate-data-volumes (checked 2026-09-25)
Update it
What docker compose pull does depends only on how each image line in the compose file above is tagged. For BookStack as this page writes it:
| Service | Image | How it is pinned | What docker compose pull does |
|---|---|---|---|
caddy | caddy:2 | Major version only (tag 2) | Takes the newest image tagged 2: minor and patch releases of 2, never 3. A new major version needs a tag edit. |
bookstack | lscr.io/linuxserver/bookstack:version-v26.03.3 | Exact version (tag version-v26.03.3) | Does not move: stays on 26.03.3 until you edit the tag (a publisher may re-push the same version on a rebuilt base). |
bookstack-mariadb database | lscr.io/linuxserver/mariadb:11.4.9 | Exact version (tag 11.4.9) | Does not move: stays on 11.4.9 until you edit the tag (a publisher may re-push the same version on a rebuilt base). |
Do not raise the major version of bookstack-mariadb by editing its tag. Keep its tag, 11.4.9, as it is when you update BookStack.
LinuxServer.io's MariaDB image checks on start whether its data needs an upgrade and says so in the log; then stop the apps that use it and run mariadb-upgrade in the container. Source: LinuxServer.io docs: mariadb, Upgrading checked 2026-09-30
What BookStack's docs say about updating
BookStack's update docs: back up the database and uploaded files first, and read the version-specific instructions for every version you pass, which list breaking changes and security notices. Its commands are for a git install; for this image LinuxServer.io's README gives docker compose pull and docker compose up -d.
- The BookStack tag here is version-v26.03.3, so a pull changes nothing: edit the tag to the new version first.
The steps
- Back up first, as in Back it up above. An update can migrate BookStack's data on its first start and its database with it; the copy is the way back.
bookstackis pinned to an exact version (see the table), so a pull alone changes nothing there: to update BookStack, first edit its tag indocker-compose.ymlto the version you want.- Download the new images. Running containers are not touched yet:
docker compose pull
- Recreate the containers whose image changed. Volumes and bind-mounted folders stay as they are:
docker compose up -d
- Watch BookStack start (Ctrl+C stops following the log, not the app):
docker compose logs -f bookstack
- Optional: remove the old images the pull left without a tag. This covers every stack on the machine, not only this one:
docker image prune
Locked out? Reset the admin password
BookStack's docs give no password reset command; they call creating a new admin from the command line a good last resort if you are locked out.
Create a new admin. Without options the command asks for the email, name and password. The LinuxServer.io image keeps BookStack in /app/www. Source: BookStack docs: Commands, Create an Admin User read 2026-10-03; LinuxServer.io docker-bookstack README (php /app/www/artisan) read 2026-10-03
docker compose exec bookstack php /app/www/artisan bookstack:create-admin
Sources
Every page below was fetched on the date shown.
- bookstackapp.com front page checked 2026-09-25 (what it does)
- BookStack docs: Installation (Docker: community LinuxServer.io setup and its example compose stack) checked 2026-09-25 (compose definition and proxy settings)
- BookStack devops repository: lsio-docker/docker-compose.yml (the example compose stack the docs link) checked 2026-09-25 (compose definition and proxy settings)
- Caddy docs: Keep Caddy running (Docker Compose section) checked 2026-09-23 (Caddy)
- Vaultwarden wiki: Caddy with HTTP challenge (uses the caddy:2 image) checked 2026-09-23 (Caddy)
- BookStack docs: Backup and Restore (mysqldump; uploads, attachments, themes, .env) checked 2026-09-25 (backup plan)
- MariaDB docs: mariadb-dump (formerly mysqldump) checked 2026-09-25 (backup plan)
- Docker docs: Volumes, Back up, restore, or migrate data volumes checked 2026-09-25 (backup plan)
- Caddy docs: Conventions, Data directory checked 2026-09-24 (backup plan)
- BookStack docs: Updating BookStack (version-specific instructions) checked 2026-09-30 (update notes)
- LinuxServer.io docker-bookstack README: Updating Info, Via Docker Compose checked 2026-09-30 (update notes)
- LinuxServer.io docs: mariadb, Upgrading checked 2026-09-30 (database upgrade)
- Docker docs: docker compose pull checked 2026-09-30 (update steps)
- Docker docs: docker compose up (recreates changed containers, keeps volumes) checked 2026-09-30 (update steps)
- Docker docs: docker image prune checked 2026-09-30 (update steps)