Bookstack +docker + mariadb #5265

Closed
opened 2026-02-05 09:52:33 +03:00 by OVERLORD · 14 comments
Owner

Originally created by @Fabio-91 on GitHub (Apr 23, 2025).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

This deployment is part of a mockup test on a Synology NAS, aiming to evaluate BookStack in a self-hosted setup using Docker.

I’m deploying the application using two separate Docker containers via docker-compose:

bookstack_db (MariaDB, image: lscr.io/linuxserver/mariadb)

bookstack (BookStack, image: lscr.io/linuxserver/bookstack)

Both containers are connected via a custom Docker network named bookstack_net.

Volumes are locally mounted at /volume1/docker/bookstack.

Errors Encountered
When launching the bookstack container, I get the following SQL errors:

SQLSTATE[HY000] [1045] — Access denied for user

SQLSTATE[HY000] [2002] — Connection refused

Image
Image
Image
Image
Image

docker-compose.yml (Sanitized for clarity) :
version: "2"

services:
bookstack_db:
image: lscr.io/linuxserver/mariadb
container_name: bookstack_db
environment:
- PUID=1026
- PGID=100
- MYSQL_ROOT_PASSWORD=91-Montgeron-DB!
- TZ=Europe/Paris
- MYSQL_DATABASE=bookstackapp
- MYSQL_USER=bookstack
- MYSQL_PASSWORD=91-Montgeron-DB!
volumes:
- /volume1/docker/bookstack/db:/config
ports:
- 3306:3306
networks:
- bookstack_net
restart: unless-stopped

bookstack:
image: lscr.io/linuxserver/bookstack
container_name: bookstack
environment:
- PUID=1026
- PGID=100
- APP_URL=http://192.168.1.11:6875/
- APP_TIMEZONE=Europe/Paris
- DB_HOST=bookstack_db
- DB_PORT=3306
- DB_USER=bookstack
- DB_PASS=91-Montgeron-DB!
- DB_DATABASE=bookstackapp
- APP_KEY=base64:CClA6bWC3qhP6yMVQECyTblYtj7uAxOh0dDpi0BcZ5w=
volumes:
- /volume1/docker/bookstack/config:/config
ports:
- 6875:80
depends_on:
- bookstack_db
networks:
- bookstack_net
restart: unless-stopped

networks:
bookstack_net:
external: true

Exact BookStack Version

BookStack v23.12.1

Log Content

No response

Hosting Environment

pc tehcnique sur windows + NAS synoloy (DS216+II)

Originally created by @Fabio-91 on GitHub (Apr 23, 2025). ### Attempted Debugging - [x] I have read the debugging page ### Searched GitHub Issues - [x] I have searched GitHub for the issue. ### Describe the Scenario This deployment is part of a mockup test on a Synology NAS, aiming to evaluate BookStack in a self-hosted setup using Docker. I’m deploying the application using two separate Docker containers via docker-compose: bookstack_db (MariaDB, image: lscr.io/linuxserver/mariadb) bookstack (BookStack, image: lscr.io/linuxserver/bookstack) Both containers are connected via a custom Docker network named bookstack_net. Volumes are locally mounted at /volume1/docker/bookstack. ❌ Errors Encountered When launching the bookstack container, I get the following SQL errors: SQLSTATE[HY000] [1045] — Access denied for user SQLSTATE[HY000] [2002] — Connection refused ![Image](https://github.com/user-attachments/assets/6152fa1a-bd21-4561-bd55-ed5b85de5819) ![Image](https://github.com/user-attachments/assets/81dad48d-c28f-4e97-8af0-3316b8ef2baf) ![Image](https://github.com/user-attachments/assets/9f633dab-dc7e-4c63-9c32-17d1352fdddb) ![Image](https://github.com/user-attachments/assets/4116fa53-c430-4ef7-a1b7-02326fc6e97e) ![Image](https://github.com/user-attachments/assets/7bdafd9f-d62e-425a-84d5-d5ea790ef52d) docker-compose.yml (Sanitized for clarity) : version: "2" services: bookstack_db: image: lscr.io/linuxserver/mariadb container_name: bookstack_db environment: - PUID=1026 - PGID=100 - MYSQL_ROOT_PASSWORD=91-Montgeron-DB! - TZ=Europe/Paris - MYSQL_DATABASE=bookstackapp - MYSQL_USER=bookstack - MYSQL_PASSWORD=91-Montgeron-DB! volumes: - /volume1/docker/bookstack/db:/config ports: - 3306:3306 networks: - bookstack_net restart: unless-stopped bookstack: image: lscr.io/linuxserver/bookstack container_name: bookstack environment: - PUID=1026 - PGID=100 - APP_URL=http://192.168.1.11:6875/ - APP_TIMEZONE=Europe/Paris - DB_HOST=bookstack_db - DB_PORT=3306 - DB_USER=bookstack - DB_PASS=91-Montgeron-DB! - DB_DATABASE=bookstackapp - APP_KEY=base64:CClA6bWC3qhP6yMVQECyTblYtj7uAxOh0dDpi0BcZ5w= volumes: - /volume1/docker/bookstack/config:/config ports: - 6875:80 depends_on: - bookstack_db networks: - bookstack_net restart: unless-stopped networks: bookstack_net: external: true ### Exact BookStack Version BookStack v23.12.1 ### Log Content _No response_ ### Hosting Environment pc tehcnique sur windows + NAS synoloy (DS216+II)
OVERLORD added the 🐕 Support label 2026-02-05 09:52:33 +03:00
Author
Owner

@Fabio-91 commented on GitHub (Apr 23, 2025):

Indeed, MySQL/MariaDB error 1045 (Access denied) can sometimes be resolved by enclosing the password in double quotes (").
"91-Montgeron-DB!"

@Fabio-91 commented on GitHub (Apr 23, 2025): Indeed, MySQL/MariaDB error 1045 (Access denied) can sometimes be resolved by enclosing the password in double quotes ("). "91-Montgeron-DB!"
Author
Owner

@ssddanbrown commented on GitHub (Apr 23, 2025):

Hi @Fabio-91,

On recent linxuserver bookstack images, you should be using DB_USERNAME instead of DB_USER, and DB_PASSWORD instead of DB_PASS.
As per #5587, you can use this recent reference compose file as a guide: https://codeberg.org/bookstack/devops/src/branch/main/config/lsio-docker/docker-compose.yml

@ssddanbrown commented on GitHub (Apr 23, 2025): Hi @Fabio-91, On recent linxuserver bookstack images, you should be using `DB_USERNAME` instead of `DB_USER`, and `DB_PASSWORD` instead of `DB_PASS`. As per #5587, you can use this recent reference compose file as a guide: https://codeberg.org/bookstack/devops/src/branch/main/config/lsio-docker/docker-compose.yml
Author
Owner

@Fabio-91 commented on GitHub (Apr 24, 2025):

HI @ssddanbrown,

Update, I corrected the 2002 error by first deleting the default .env file located in ./bookstack_app_data/www/.env.

I then modified this file with my own parameters, and returned it to its original location.

After that, I checked the BookStack logs (./bookstack_app_data/log/bookstack/laravel.log), and the 2002 error had disappeared.

However, error 1045 still persists, even though I thought I'd fixed it by adding quotation marks around the password ("password").

@Fabio-91 commented on GitHub (Apr 24, 2025): HI @ssddanbrown, Update, I corrected the 2002 error by first deleting the default .env file located in ./bookstack_app_data/www/.env. I then modified this file with my own parameters, and returned it to its original location. After that, I checked the BookStack logs (./bookstack_app_data/log/bookstack/laravel.log), and the 2002 error had disappeared. However, error 1045 still persists, even though I thought I'd fixed it by adding quotation marks around the password ("password").
Author
Owner

@ssddanbrown commented on GitHub (Apr 24, 2025):

@Fabio-91 Environment variables set in the docker compose fill will take precedence over any .env values.

My suggestion (assuming this is a new instance) would be to start from fresh.
Delete all prior volumes/data/containers, then start again from our example compose file linked above.
You should not need to change any volume data files to get a working instance.

@ssddanbrown commented on GitHub (Apr 24, 2025): @Fabio-91 Environment variables set in the docker compose fill will take precedence over any `.env` values. My suggestion (assuming this is a new instance) would be to start from fresh. Delete all prior volumes/data/containers, then start again from our example compose file linked above. You should not need to change any volume data files to get a working instance.
Author
Owner

@Fabio-91 commented on GitHub (Apr 24, 2025):

@ssddanbrown
I started from scratch to do a test: I separated the two containers (BookStack and MariaDB), and strangely, it worked — no more MySQL-related errors. 👍

However, now I can't access the BookStack web page. The container is running fine, no visible errors, but nothing shows up when I try to open the URL.

Do you have any idea what I should check?

Here are the following screenshots to show the current situation:

User account:

Image

Image:

Image

Network:

Image

UID:

Image

Document:

Image

MariaDB docker-compose.yml:

version: "3.8"

services:
mariadb:
image: lscr.io/linuxserver/mariadb
container_name: mariadb
environment:
- PUID=1026
- PGID=100
- TZ=Europe/Paris
- MYSQL_ROOT_PASSWORD=bookstack91421
- MYSQL_DATABASE=bookstack
- MYSQL_USER=bookstack
- MYSQL_PASSWORD=bookstack91421
volumes:
- ./db:/config
restart: unless-stopped
networks:
- bookstack_net

networks:
bookstack_net:
external: true

Image

BookStack docker-compose.yml:

version: "3.8"

services:
bookstack:
image: lscr.io/linuxserver/bookstack
container_name: bookstack
environment:
- PUID=1026
- PGID=100
- TZ=Europe/Paris
- APP_URL=http://192.168.1.11:6875
- APP_KEY=base64:CClA6bWC3qhP6yMVQECyTblYtj7uAxOh0dDpi0BcZ5w=
- DB_HOST=mariadb
- DB_PORT=3306
- DB_DATABASE=bookstack
- DB_USERNAME=bookstack
- DB_PASSWORD=bookstack91421
volumes:
- ./app:/config
ports:
- 6875:80
restart: unless-stopped
networks:
- bookstack_net

networks:
bookstack_net:
external: true

Image

To sum up, I now have two separate projects, each running a single container — one for MariaDB and one for BookStack.

Image

@Fabio-91 commented on GitHub (Apr 24, 2025): @ssddanbrown I started from scratch to do a test: I separated the two containers (BookStack and MariaDB), and strangely, it worked — no more MySQL-related errors. 👍 However, now I can't access the BookStack web page. The container is running fine, no visible errors, but nothing shows up when I try to open the URL. Do you have any idea what I should check? Here are the following screenshots to show the current situation: **User account:** ![Image](https://github.com/user-attachments/assets/04edc843-88ee-493d-97a9-26a3698ca625) **Image:** ![Image](https://github.com/user-attachments/assets/d46c7d93-d178-41fc-8a3b-b63ceb46f1ce) **Network:** ![Image](https://github.com/user-attachments/assets/15c0f5a5-be58-4db1-b2b2-d2d8b33cd458) **UID:** ![Image](https://github.com/user-attachments/assets/ae498e53-4b38-45a9-a8ee-b15f13758aa6) **Document:** ![Image](https://github.com/user-attachments/assets/340a9efb-4ff7-40ca-9af5-db4a6ad0b370) **MariaDB docker-compose.yml:** version: "3.8" services: mariadb: image: lscr.io/linuxserver/mariadb container_name: mariadb environment: - PUID=1026 - PGID=100 - TZ=Europe/Paris - MYSQL_ROOT_PASSWORD=bookstack91421 - MYSQL_DATABASE=bookstack - MYSQL_USER=bookstack - MYSQL_PASSWORD=bookstack91421 volumes: - ./db:/config restart: unless-stopped networks: - bookstack_net networks: bookstack_net: external: true ![Image](https://github.com/user-attachments/assets/bdac4443-3c75-497e-a2cd-318d66fedc90) **BookStack docker-compose.yml:** version: "3.8" services: bookstack: image: lscr.io/linuxserver/bookstack container_name: bookstack environment: - PUID=1026 - PGID=100 - TZ=Europe/Paris - APP_URL=http://192.168.1.11:6875 - APP_KEY=base64:CClA6bWC3qhP6yMVQECyTblYtj7uAxOh0dDpi0BcZ5w= - DB_HOST=mariadb - DB_PORT=3306 - DB_DATABASE=bookstack - DB_USERNAME=bookstack - DB_PASSWORD=bookstack91421 volumes: - ./app:/config ports: - 6875:80 restart: unless-stopped networks: - bookstack_net networks: bookstack_net: external: true ![Image](https://github.com/user-attachments/assets/4fa63c73-dec4-4ec5-bc38-dd2d44215683) To sum up, I now have two separate projects, each running a single container — one for MariaDB and one for BookStack. ![Image](https://github.com/user-attachments/assets/d12879d2-3b39-4fc3-be69-1c2a2eea6123)
Author
Owner

@ssddanbrown commented on GitHub (Apr 24, 2025):

The container is running fine, no visible errors, but nothing shows up when I try to open the URL.

What exactly do you see when accessing via the browser?

@ssddanbrown commented on GitHub (Apr 24, 2025): > The container is running fine, no visible errors, but nothing shows up when I try to open the URL. What exactly do you see when accessing via the browser?
Author
Owner

@Fabio-91 commented on GitHub (Apr 24, 2025):

@ssddanbrown
Image

@Fabio-91 commented on GitHub (Apr 24, 2025): @ssddanbrown ![Image](https://github.com/user-attachments/assets/c04b0aa9-07a7-43e6-95df-cd8ca32441d5)
Author
Owner

@ssddanbrown commented on GitHub (Apr 24, 2025):

Is the firewall active on your synology box, and if so is port 6875 allowed through it?

@ssddanbrown commented on GitHub (Apr 24, 2025): Is [the firewall](https://kb.synology.com/en-af/DSM/help/DSM/AdminCenter/connection_security_firewall?version=7) active on your synology box, and if so is port 6875 allowed through it?
Author
Owner

@Fabio-91 commented on GitHub (Apr 24, 2025):

@ssddanbrown

I dont have firewall.

Image

Does the nas need to be connected to the internet to display the web page?

@Fabio-91 commented on GitHub (Apr 24, 2025): @ssddanbrown I dont have firewall. ![Image](https://github.com/user-attachments/assets/1c5a1a92-6ac9-4dfc-848f-b20cca534dee) Does the nas need to be connected to the internet to display the web page?
Author
Owner

@ssddanbrown commented on GitHub (Apr 24, 2025):

@Fabio-91 No, you just need to be on the same local network. Is 192.168.1.11 the IP address of the NAS?

@ssddanbrown commented on GitHub (Apr 24, 2025): @Fabio-91 No, you just need to be on the same local network. Is `192.168.1.11` the IP address of the NAS?
Author
Owner

@Fabio-91 commented on GitHub (Apr 24, 2025):

@ssddanbrown

Yes 192.168.1.11 is my NAS address.

@Fabio-91 commented on GitHub (Apr 24, 2025): @ssddanbrown Yes 192.168.1.11 is my NAS address.
Author
Owner

@ssddanbrown commented on GitHub (Apr 24, 2025):

Okay. In that case I'm not sure thy you can't connect assuming you're on the same local network.
I'm not familiar enough with the options and behaviour of Synology docker management to know what might be the issue.

Maybe it's the network type used for the BookStack container? Does it state the network type anywhere?
Also, is the port mapping retained after container creation? If you look at the BookStack container can you see the port mapping anywhere in the UI?

@ssddanbrown commented on GitHub (Apr 24, 2025): Okay. In that case I'm not sure thy you can't connect assuming you're on the same local network. I'm not familiar enough with the options and behaviour of Synology docker management to know what might be the issue. Maybe it's the network type used for the BookStack container? Does it state the network type anywhere? Also, is the port mapping retained after container creation? If you look at the BookStack container can you see the port mapping anywhere in the UI?
Author
Owner

@Fabio-91 commented on GitHub (Apr 25, 2025):

@ssddanbrown
It turned out the issue was related to the network configuration.
I created a custom Docker network from the command line (sudo docker network create bookstack_net), and it was assigned the subnet 172.20.0.0.
After attaching my containers to this new network, everything started working properly.
Thanks a lot for your help!

@Fabio-91 commented on GitHub (Apr 25, 2025): @ssddanbrown It turned out the issue was related to the network configuration. I created a custom Docker network from the command line (sudo docker network create bookstack_net), and it was assigned the subnet 172.20.0.0. After attaching my containers to this new network, everything started working properly. Thanks a lot for your help!
Author
Owner

@ssddanbrown commented on GitHub (Apr 26, 2025):

Good to hear you got things working! Will therefore close this off.

@ssddanbrown commented on GitHub (Apr 26, 2025): Good to hear you got things working! Will therefore close this off.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#5265