Docker Stack For BookStack
- latest
- v21.08.2
- v21.08
- 21.05.4
- 21.05.3
- 21.05.2
- 21.05.1
- 21.04.2
- 0.31.8
- 0.30.1
- 0.30.0
- 0.29.3
- 0.29.0
- 0.28.3
- 0.28.2
- 0.28.0
- 0.27.5
- 0.27.4
- 0.26.2
- 0.26.1
- 0.26.0
- 0.25.5
- PHP 8.0-fpm-alpine - BookStack
- Caddy or NGINX - web server
- MariaDB - database
- Redis Alpine - cache
Use Docker Compose or Docker Swarm to deploy. Containers are available from both Docker Hub and the GitHub Container Registry.
There are examples for using either Caddy or NGINX as the web server and examples for using Caddy, NGINX, or Traefik for HTTPS (the Traefik example also includes using it as a reverse proxy). The NGINX examples are in the nginx folder.
I recommend using Caddy as the web server and either have it handle HTTPS or pair it with Traefik as they both have native ACME support for automatically getting HTTPS certificates from Let's Encrypt or will create self signed certificates for local use.
If you can I also recommend using Docker Swarm over Docker Compose as it supports Docker Secrets and Docker Configs.
If Caddy doesn't work for you or you are chasing performance then checkout the NGINX examples. I haven't done any performance testing but NGINX has a lot of configurability which may let you squeeze out better performance if you have a lot of users, also check the performance section below.
Configuration consists of setting environment variables in the .yml
files. More environment variables for configuring BookStack and PHP can be found in docker-entrypoint.sh
and for Caddy in bookstack_caddyfile
.
Setting the DOMAIN
variable changes whether Caddy uses HTTP, HTTPS with a self signed certificate, or HTTPS with a certificate from Let's Encrypt or ZeroSSL. Check the Caddy documentation for more info.
Once the container is started you can login with username [email protected]
and password password
.
I personally use this with Traefik as a reverse proxy, I've included an example traefik.yml
but it's not necessary.
You'll need to create the appropriate Docker Secrets and Docker Configs.
Run with docker stack deploy --compose-file docker-swarm.yml bookstack
Run with docker-compose up -d
. View using 127.0.0.1:9080
.
Set the POST_MAX_SIZE
, UPLOAD_MAX_FILESIZE
, and MEMORY_LIMIT
variables to whatever you want the max file upload size to be (MEMORY_LIMIT
should at least be 128M). See the BookStack documentation for more information.
The web servers set the relevant HTTP headers to have browsers cache as much as they can for as long as they can while requiring browsers to check if those files have changed, this is to get the benefit of caching without having to deal with the caches potentially serving old content. If content doesn't change that often or can be invalidated in another way then this behavior can be changed to reduce the number of requests.
By default I set PHP to scale up child processes based on demand, this is great for a low resource and light usage environment but setting this to be dynamic or static will yield better performance. Check the PHP Configuration section in docker-entrypoint.sh
for some tuning options to set and/or research.
If using docker volumes and the default user (www-data
with a UID and GID of 82
) you shouldn't need to do anything. However if you run the container as a different user or have any permissions issues you may need to change the permissions for /var/www/bookstack
.
One way to change the permissions would be to the change the entrypoint for the BookStack container in the .yml
file to entrypoint: sleep 900m
and attach to the container as root
and run chown -R www-data:www-data /var/www/bookstack
, or instead of attaching to the container you could run docker exec -it --user root BOOKSTACK_CONTAINER /bin/sh -c "chown -R www-data:www-data /var/www/bookstack"
This is a fork of solidnerd/docker-bookstack which itself is a fork of Kilhog/docker-bookstack.