Can't change the port for the MariaDB #4593

Closed
opened 2026-02-05 09:06:27 +03:00 by OVERLORD · 0 comments
Owner

Originally created by @ZuluPilgrim on GitHub (Apr 9, 2024).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

I need my MariaDB to listen on a port other than 3306 but no matter what I do it listens on 3306. I tried changing my docker-compose so that Bookstack connects via 3307 and MariaDB uses a 3307:3306 mapping but no matter what I do (even using environment variable MYSQL_TCP_PORT:3307) MariaDB still listens on 3306.

A developer friend suggest that I ask here.

version: "2"
services:
  bookstack:
    image: lscr.io/linuxserver/bookstack
    container_name: bookstack-recipes
    environment:
      - PUID=1000
      - PGID=1000
      - APP_URL=https://mysite.com  
      - DB_HOST=bookstack-recipes_db
      - DB_PORT=3307
      - DB_USER=user
      - DB_PASS=dbpwd
      - DB_DATABASE=recipesapp
    volumes:
      - ./recipes_app_data:/config
    ports:
      - 6877:80
    restart: unless-stopped
    depends_on:
      - bookstack_db
  bookstack_db:
    image: lscr.io/linuxserver/mariadb
    container_name: bookstack_db
    environment:
      - PUID=1000
      - PGID=1000
      - MYSQL_ROOT_PASSWORD=rootpwd
      - TZ=Pacific/Auckland
      - MYSQL_DATABASE=recipesapp
      - MYSQL_USER=user
      - MYSQL_PASSWORD=dbpwd
    volumes:
      - ./recipes_db_data:/config
    ports:
      - 3307:3306
    restart: unless-stopped

Exact BookStack Version

v24.02.2

Log Content

bookstack-recipes     | Waiting for DB to be available
bookstack-recipes     |
bookstack-recipes     |    Illuminate\Database\QueryException
bookstack-recipes     |
bookstack-recipes     |   SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = recipesapp and table_name = migrations and table_type = 'BASE TABLE')
bookstack-recipes     |
bookstack-recipes     |   at /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:760
bookstack-recipes     |     756▕         // If an exception occurs when attempting to run a query, we'll format the error
bookstack-recipes     |     757▕         // message to include the bindings with SQL, which will make this exception a
bookstack-recipes     |     758▕         // lot more helpful to the developer instead of just the database's errors.
bookstack-recipes     |     759▕         catch (Exception $e) {
bookstack-recipes     |   ➜ 760▕             throw new QueryException(
bookstack-recipes     |     761▕                 $query, $this->prepareBindings($bindings), $e
bookstack-recipes     |     762▕             );
bookstack-recipes     |     763▕         }
bookstack-recipes     |     764▕     }
bookstack-recipes     |
bookstack-recipes     |       +39 vendor frames
bookstack-recipes     |   40  /app/www/artisan:35
bookstack-recipes     |       Illuminate\Foundation\Console\Kernel::handle()
bookstack-recipes     | [custom-init] No custom files found, skipping...
bookstack-recipes     | [ls.io-init] done.

Hosting Environment

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.4 LTS"

Docker Compose version v2.24.7

Client: Docker Engine - Community
 Version:           25.0.4
 API version:       1.44
 Go version:        go1.21.8
 Git commit:        1a576c5
 Built:             Wed Mar  6 16:32:12 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          25.0.4
  API version:      1.44 (minimum version 1.24)
  Go version:       go1.21.8
  Git commit:       061aa95
  Built:            Wed Mar  6 16:32:12 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.28
  GitCommit:        ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Originally created by @ZuluPilgrim on GitHub (Apr 9, 2024). ### Attempted Debugging - [X] I have read the debugging page ### Searched GitHub Issues - [X] I have searched GitHub for the issue. ### Describe the Scenario I need my MariaDB to listen on a port other than 3306 but no matter what I do it listens on 3306. I tried changing my docker-compose so that Bookstack connects via 3307 and MariaDB uses a 3307:3306 mapping but no matter what I do (even using environment variable MYSQL_TCP_PORT:3307) MariaDB still listens on 3306. A developer friend suggest that I ask here. ``` version: "2" services: bookstack: image: lscr.io/linuxserver/bookstack container_name: bookstack-recipes environment: - PUID=1000 - PGID=1000 - APP_URL=https://mysite.com - DB_HOST=bookstack-recipes_db - DB_PORT=3307 - DB_USER=user - DB_PASS=dbpwd - DB_DATABASE=recipesapp volumes: - ./recipes_app_data:/config ports: - 6877:80 restart: unless-stopped depends_on: - bookstack_db bookstack_db: image: lscr.io/linuxserver/mariadb container_name: bookstack_db environment: - PUID=1000 - PGID=1000 - MYSQL_ROOT_PASSWORD=rootpwd - TZ=Pacific/Auckland - MYSQL_DATABASE=recipesapp - MYSQL_USER=user - MYSQL_PASSWORD=dbpwd volumes: - ./recipes_db_data:/config ports: - 3307:3306 restart: unless-stopped ``` ### Exact BookStack Version v24.02.2 ### Log Content ``` bookstack-recipes | Waiting for DB to be available bookstack-recipes | bookstack-recipes | Illuminate\Database\QueryException bookstack-recipes | bookstack-recipes | SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = recipesapp and table_name = migrations and table_type = 'BASE TABLE') bookstack-recipes | bookstack-recipes | at /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:760 bookstack-recipes | 756▕ // If an exception occurs when attempting to run a query, we'll format the error bookstack-recipes | 757▕ // message to include the bindings with SQL, which will make this exception a bookstack-recipes | 758▕ // lot more helpful to the developer instead of just the database's errors. bookstack-recipes | 759▕ catch (Exception $e) { bookstack-recipes | ➜ 760▕ throw new QueryException( bookstack-recipes | 761▕ $query, $this->prepareBindings($bindings), $e bookstack-recipes | 762▕ ); bookstack-recipes | 763▕ } bookstack-recipes | 764▕ } bookstack-recipes | bookstack-recipes | +39 vendor frames bookstack-recipes | 40 /app/www/artisan:35 bookstack-recipes | Illuminate\Foundation\Console\Kernel::handle() bookstack-recipes | [custom-init] No custom files found, skipping... bookstack-recipes | [ls.io-init] done. ``` ### Hosting Environment ``` DISTRIB_ID=Ubuntu DISTRIB_RELEASE=22.04 DISTRIB_CODENAME=jammy DISTRIB_DESCRIPTION="Ubuntu 22.04.4 LTS" ``` `Docker Compose version v2.24.7` ``` Client: Docker Engine - Community Version: 25.0.4 API version: 1.44 Go version: go1.21.8 Git commit: 1a576c5 Built: Wed Mar 6 16:32:12 2024 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 25.0.4 API version: 1.44 (minimum version 1.24) Go version: go1.21.8 Git commit: 061aa95 Built: Wed Mar 6 16:32:12 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.28 GitCommit: ae07eda36dd25f8a1b98dfbf587313b99c0190bb runc: Version: 1.1.12 GitCommit: v1.1.12-0-g51d5e94 docker-init: Version: 0.19.0 GitCommit: de40ad0 ```
OVERLORD added the 🐕 Support label 2026-02-05 09:06:27 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#4593