Running Gnuboard5 locally with Docker Compose and Dev Containers
Set up Gnuboard5 v5.6.58 with PHP 8.5, MariaDB 11.8, and Mailpit using Docker Compose and Dev Containers, including data volume isolation and mail checks.
Local Gnuboard5 (
v5.6.58) setups often stall on three things: missing PHP extensions,data/permission errors on bind mounts, and security emails that refuse to send withoutG5_DOMAINand an SMTP server. Here is how the Docker Compose and VS Code Dev Container stack in commit335783c34solves all three on PHP 8.5.13, MariaDB 11.8.10, and Mailpit v1.34.1.
Every command and output in this post was verified locally against Gnuboard5
v5.6.58(public commit335783c34) runningphp:8.5-apache-trixie,mariadb:11.8, andaxllent/mailpit:v1.34.1.
Three friction points in local Gnuboard5 setups
Installing Apache, PHP, and MariaDB directly on your host machine works until you switch PHP versions or reset a test install. Three issues come up repeatedly:
- Extension drift across hosts. The web installer (
/install/) requiresmysqli,json,iconv, andgd, and recommendsmbstring,openssl, andcurl. Optional features also rely onexiffor image orientation,zipfor Excel exports,soapfor legacy YoungCart integrations, andSimpleXML. Package names and GD flags (FreeType, JPEG, WebP) differ across OSes. - Writable
data/directories on bind mounts. Mounting the repository root directly into/var/www/htmlleaves Apache (www-data) unable to writedata/dbconfig.phpor uploaded files. The usual workaround—chmod 707 dataon the host—mixes container-owned files into your working tree. - Local email testing with
G5_DOMAINchecks. Password reset and verification emails in Gnuboard5 require both an SMTP target and a validG5_DOMAIN. Wiring a real SMTP account just to test local flows slows down iteration and risks sending noise to real inboxes.
Container topology, loopback ports, and health checks
The compose.yaml file splits the stack into three services: web, db, and mailpit. Host access stays restricted to 127.0.0.1, while containers talk over the internal Compose network (db:3306 and mailpit:1025).
flowchart TD
Host["Host Browser / IDE (127.0.0.1)"] -->|"HTTP :8080"| Web["web (PHP 8.5 + Apache)"]
Host -->|"Web UI :8025"| Mailpit["mailpit (v1.34.1)"]
Web -->|"SQL db:3306"| DB["db (MariaDB 11.8)"]
Web -->|"SMTP mailpit:1025"| Mailpit
Web -->|"Overlay /var/www/html/data"| Vol["gnuboard-data volume"]
Here is the full compose.yaml at the repository root:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# compose.yaml
services:
web:
build: .devcontainer
command:
- sh
- -ec
- |
install -d -o www-data -g www-data -m 0755 /var/www/html/data
exec apache2-foreground
environment:
G5_DOMAIN: "http://127.0.0.1:${GNUBOARD_WEB_PORT:-8080}"
G5_SMTP: mailpit
G5_SMTP_PORT: "1025"
ports:
- "127.0.0.1:${GNUBOARD_WEB_PORT:-8080}:80"
volumes:
- .:/var/www/html
- gnuboard-data:/var/www/html/data
depends_on:
db:
condition: service_healthy
mailpit:
condition: service_healthy
db:
image: mariadb:11.8
environment:
MARIADB_DATABASE: gnuboard
MARIADB_USER: gnuboard
MARIADB_PASSWORD: gnuboard
MARIADB_RANDOM_ROOT_PASSWORD: "1"
ports:
- "127.0.0.1:${GNUBOARD_DB_PORT:-3306}:3306"
volumes:
- db-data:/var/lib/mysql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 5s
timeout: 5s
retries: 12
start_period: 30s
mailpit:
image: axllent/mailpit:v1.34.1
ports:
- "127.0.0.1:${GNUBOARD_MAILPIT_PORT:-8025}:8025"
volumes:
gnuboard-data:
db-data:
Three design details matter here:
- Loopback-only ports with
.envsync. Every exposed port binds to127.0.0.1, keeping the local database and Mailpit UI off your LAN. If8080,3306, or8025is already taken on your machine, overrideGNUBOARD_WEB_PORT,GNUBOARD_DB_PORT, orGNUBOARD_MAILPIT_PORTin a root.envfile (ignored by.gitignore). BecauseG5_DOMAINreads the same${GNUBOARD_WEB_PORT:-8080}variable, generated links stay in sync without editingcompose.yaml. - MariaDB 11.8
healthcheck.shand random root passwords. Instead of a bare TCP check,dbruns MariaDB’s officialhealthcheck.sh --connect --innodb_initialized. That waits until InnoDB finishes bootstrapping before markingdbhealthy, avoiding the startup race I covered in controlling Docker Compose startup order withdepends_onandservice_healthy. SettingMARIADB_RANDOM_ROOT_PASSWORD: "1"avoids hardcoding a root password while the app connects with thegnuboarduser. - Inherited Mailpit
HEALTHCHECK. You might noticemailpithas nohealthcheck:block incompose.yaml, yetdepends_on: condition: service_healthystill works. Theaxllent/mailpit:v1.34.1image defines its ownHEALTHCHECKusing/mailpit readyz:
1
docker image inspect axllent/mailpit:v1.34.1 --format '{{json .Config.Healthcheck}}'
1
{"Test":["CMD","/mailpit","readyz"],"Interval":15000000000,"StartPeriod":10000000000,"StartInterval":1000000000}
In my local test run (docker compose up -d --build), mailpit turned healthy in 1.8 s and db (11.8.10-MariaDB-ubu2404) in 5.7 s, and web started right after both passed.
PHP 8.5 extensions and Apache dotfile blocking
The web image starts from php:8.5-apache-trixie (PHP 8.5.13, Apache/2.4.71, Debian 13 trixie) and compiles only the five missing extensions.
1
2
3
4
5
6
7
8
9
10
11
12
13
# .devcontainer/Dockerfile
FROM php:8.5-apache-trixie
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git libfreetype-dev libjpeg62-turbo-dev libpng-dev libwebp-dev libxml2-dev libzip-dev \
&& docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \
&& docker-php-ext-install -j"$(nproc)" exif gd mysqli soap zip \
&& rm -rf /var/lib/apt/lists/* \
&& useradd --create-home --shell /bin/bash developer
COPY gnuboard.conf /etc/apache2/conf-available/gnuboard.conf
RUN a2enmod rewrite && a2enconf gnuboard
Out of the 11 extensions listed across install/library.check.php and README.md, six ship with the base image and five come from docker-php-ext-install:
| Tier | Extensions | Source in php:8.5-apache-trixie | Purpose |
|---|---|---|---|
| Required (4) | json, iconv | Built-in | Installer responses, character encoding |
| Required (4) | mysqli, gd | Compiled (freetype, jpeg, webp) | MariaDB driver, CAPTCHA and thumbnails |
| Recommended (3) | mbstring, openssl, curl | Built-in | Multibyte strings, TLS, external API calls |
| Optional (4) | SimpleXML | Built-in | XML parsing |
| Optional (4) | exif, zip, soap | Compiled | Image orientation, Excel export, YoungCart hooks |
Running php -m and gd_info() inside the container confirms all 11 extensions load with FreeType, JPEG, and WebP enabled. Opening /install/ shows all seven installer environment checks passing (확인 means verified in the Korean installer UI).
Figure 1. Gnuboard5 /install/ environment check running on local php:8.5-apache-trixie (PHP 8.5.13), with all four required and three recommended checks passing.
Mounting the entire repository root into /var/www/html exposes .git/, .env, .devcontainer/, and compose.yaml under Apache’s document root unless you block them explicitly. At the same time, Gnuboard5’s short URLs rely on .htaccess rewrite rules. .devcontainer/gnuboard.conf handles both:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# .devcontainer/gnuboard.conf
ServerName localhost
<Directory /var/www/html>
Options -Indexes
AllowOverride All
<FilesMatch "^\.|^compose\.yaml$">
Require all denied
</FilesMatch>
</Directory>
<DirectoryMatch "^/var/www/html/(?:[^/]+/)*\.">
Require all denied
</DirectoryMatch>
Options -Indexes disables directory listings, AllowOverride All plus a2enmod rewrite enables .htaccess rewrites, and the <FilesMatch> and <DirectoryMatch> blocks deny dotfiles, dot-directories, and compose.yaml. Checking the running container with curl confirms the rules:
1
2
3
4
for p in "/.env" "/.git/HEAD" "/.devcontainer/devcontainer.json" "/compose.yaml" "/img/" "/" "/install/"; do
code=$(curl -s -o /dev/null -w '%{http_code}' "http://127.0.0.1:8080${p}")
echo "GET ${p} -> HTTP ${code}"
done
1
2
3
4
5
6
7
GET /.env -> HTTP 403
GET /.git/HEAD -> HTTP 403
GET /.devcontainer/devcontainer.json -> HTTP 403
GET /compose.yaml -> HTTP 403
GET /img/ -> HTTP 403
GET / -> HTTP 200
GET /install/ -> HTTP 200
All five protected paths return 403 Forbidden, while / and /install/ return 200.
Overlaying the data volume and wiring Mailpit
You want live code edits from the host (.:/var/www/html), but you don’t want Apache writing runtime files into your host tree. Overlaying a named volume (gnuboard-data:/var/www/html/data) on top of the bind mount isolates runtime writes, following the pattern from managing Docker volume and bind mount permissions.
Right before starting Apache, the container runs:
1
2
install -d -o www-data -g www-data -m 0755 /var/www/html/data
exec apache2-foreground
In local testing, this gave three clean guarantees:
/var/www/html/datainitializes aswww-data:www-datawith mode0755, so the web installer finishes withoutchmod 707.data/dbconfig.phplives inside thegnuboard-datavolume. Runningdocker compose down && docker compose up -dpreserves the installed site and database, whiledocker compose down -vwipes both volumes and resets to the installer.- One small caveat: if
data/doesn’t exist on the host yet, Docker creates an emptydata/directory on the host as the mountpoint. No files get written there, and.gitignorealready ignoresdata/, sogit statusstays clean.
For local email delivery, config.php reads environment variables with fallbacks to the original defaults:
1
2
3
4
// config.php (environment variable fallbacks)
define('G5_DOMAIN', getenv('G5_DOMAIN') ?: '');
define('G5_SMTP', getenv('G5_SMTP') ?: '127.0.0.1');
define('G5_SMTP_PORT', getenv('G5_SMTP_PORT') ?: '25');
Existing non-Docker deployments keep their original defaults ('', '127.0.0.1', '25'), while the container automatically injects G5_DOMAIN, mailpit, and 1025. When checking config.php directly from the CLI, define $g5_path first to avoid an undefined variable warning:
1
2
3
4
5
# Inside the container (Compose env applied)
docker compose exec web php -r '$g5_path=["path"=>"."]; require "config.php"; echo G5_DOMAIN, " / ", G5_SMTP, ":", G5_SMTP_PORT, "\n";'
# With env vars cleared (verifying host fallback defaults)
docker compose exec -e G5_DOMAIN= -e G5_SMTP= -e G5_SMTP_PORT= web php -r '$g5_path=["path"=>"."]; require "config.php"; var_dump(G5_DOMAIN, G5_SMTP, G5_SMTP_PORT);'
1
2
3
4
5
6
7
# Inside the container (Compose env applied)
http://127.0.0.1:8080 / mailpit:1025
# With env vars cleared (fallback defaults)
string(0) ""
string(9) "127.0.0.1"
string(2) "25"
Setting G5_DOMAIN is required for security emails, not optional. When G5_DOMAIN is empty, g5_security_mail_base_url() returns false, and the security mail handler blocks the send and writes [g5 security mail] Valid G5_DOMAIN is required. to the PHP error log. With G5_DOMAIN populated (even after overriding GNUBOARD_WEB_PORT=18081 in .env), mailer() delivers through mailpit:1025 and the verification link inside the message matches the active port.
Figure 2. Mailpit v1.34.1 web UI showing a password-reset test email sent via mailpit:1025 in a local Docker Compose run with .env ports 18081 and 18026.
Reusing the stack in VS Code Dev Containers
To avoid maintaining two separate container definitions, .devcontainer/devcontainer.json points directly to ../compose.yaml:
1
2
3
4
5
6
7
8
9
10
// .devcontainer/devcontainer.json
{
"name": "그누보드5",
"dockerComposeFile": "../compose.yaml",
"service": "web",
"workspaceFolder": "/var/www/html",
"remoteUser": "developer",
"overrideCommand": false,
"shutdownAction": "stopCompose"
}
Each key has a specific job:
overrideCommand: false: By default, Dev Containers replaces a Compose service’s command withsleep infinity. Setting this tofalsepreservesinstall -d ... && exec apache2-foregroundso Apache stays alive as PID 1.remoteUser: "developer": Inside the container, Apache’s master process runs asroot(PID 1) and its workers run aswww-data(UID 33), while your interactive shell uses the non-rootdeveloperaccount (UID 1000,/bin/bash).shutdownAction: "stopCompose": Closing the VS Code window stopsweb,db, andmailpittogether instead of leaving background containers running.
Verification scope: Process separation (
root/www-datavsdeveloperUID 1000) and file writes to/var/www/htmlasdeveloperwere tested inside the container on macOS Docker Desktop (VirtioFS). VS Code GUI actions (Reopen in Container and window-closeshutdownAction) and Linux host UID remapping (updateRemoteUserUIDwhen the host UID isn’t 1000) weren’t executed via GUI in this CLI test and follow the official Dev Containers specification.
When not to use this setup and checklist
Pick the workflow that matches how your team edits and runs PHP code:
| Approach | Best fit | Upside | Trade-off |
|---|---|---|---|
| Host APM / Homebrew | Solo work pinned to one PHP version | Zero container overhead | Extension drift, manual data/ resets, external SMTP setup |
Docker Compose CLI (compose.yaml) | Keeping your host IDE (PhpStorm, Vim) while isolating runtime | One command for PHP, MariaDB, Mailpit; easy .env port swaps | Host and container PHP CLI versions can diverge |
| VS Code Dev Container | Team onboarding and identical PHP CLI/Git tooling | Everyone runs inside the same container image and shell | Initial build time and VS Code Remote extension requirement |
This
compose.yamland.devcontainersetup is strictly for local development and testing. Do not deploy it to production.
It breaks production security assumptions in four ways: the database password (gnuboard) is hardcoded in compose.yaml, G5_DOMAIN uses plain HTTP on 127.0.0.1, the entire repository is bind-mounted into Apache’s document root, and Mailpit intercepts all outgoing mail instead of delivering it. Production deployments need immutable built images, HTTPS behind a reverse proxy, secret management, and a real SMTP relay.
Before using this stack day to day, keep these five checks in mind:
- If
8080,3306, or8025is already in use, setGNUBOARD_WEB_PORT,GNUBOARD_DB_PORT, orGNUBOARD_MAILPIT_PORTin a root.envfile instead of editingcompose.yaml. - During the
/install/wizard, enterdb(notlocalhost) as the database host, andgnuboardfor the user, password, and database name. - Run
docker compose down -vwhenever you want a clean reinstall; plaindocker compose downkeeps bothgnuboard-dataanddb-data. - Run
docker compose build --pull web && docker compose up -dwhen pulling newer PHP 8.5 patch releases. - On native Linux hosts where your user UID isn’t
1000, verify file ownership on the bind mount if you rundocker composewithout VS Code’supdateRemoteUserUID.