Docker image for phpBB3 on Apache with PHP 8.4 and ImageMagick — self-hosted forum on Debian Trixi
3.0K
phpBB is a popular open-source bulletin board that features robust messaging capabilities: flat message structure, subforums, topic split/merge/lock, user groups, full-text search, and attachments.
This image provides a Docker-based deployment for phpBB3 on Apache with PHP 8.4 (Debian Trixie). It was originally created for the Crossfire Forums but the packaging is general-purpose and not specific to that deployment.
Key differences from the official phpBB distribution:
cli builder
stage; only runtime libraries copied into the apache final stageimagick PECL extension) and GD enabledmod_remoteip configured for reverse-proxy deploymentsThis image does not auto-provision phpBB from environment variables the way some other packaged images do. phpBB is configured through its own web-based installer on first run — see First-time setup.
docker run --name phpbb basictheprogram/crossfire-phpbb3:latest
Warning
This quick setup is for development only. Change default credentials before any production use.
Docker Engine 20.10 or later. Docker Compose v2 recommended.
Pull from Docker Hub:
docker pull basictheprogram/crossfire-phpbb3:latest
Pull a specific version:
docker pull basictheprogram/crossfire-phpbb3:[TAG]
Tags follow the phpBB3 upstream version. CI publishes:
latest and <version> (e.g. 3.3.19) on pushes to maindevel-<version> on pushes to devel<commit-sha> on every pushAvailable tags: https://hub.docker.com/repository/docker/basictheprogram/crossfire-phpbb3/tags
Build locally:
git clone https://github.com/crossfire-projects/docker-phpbb.git
cd docker-phpbb
docker build -t crossfire-phpbb3 php/
phpBB3 requires a MySQL or MariaDB database. Use Docker Compose to run both together:
docker compose up -d
Copy .env.sample to .env and fill in real values first —
compose.yml reads its database and Traefik settings from there.
This image does not auto-provision phpBB from environment variables. On
first run, phpBB's own installer is still present in the image; the
PHPBB_DATABASE_* values in compose.yml are not read by anything in the
image; they're there so you have one place to keep the values consistent
with what you type into the installer.
docker compose up -dhttp://<host>/install/ and complete phpBB's installer
(database connection, admin account, forum name, etc.)config.php (persisted on the phpbb_config
volume), the container's entrypoint automatically removes the install/
directory the next time it starts — restart the phpbb container to
trigger thatcompose.yml already defines named volumes for the database and every
phpBB directory that needs to survive a container recreate:
services:
mysql:
volumes:
- phpbb-mysql-data:/var/lib/mysql
phpbb:
volumes:
- phpbb_config:/config-volume # config.php (DB credentials)
- phpbb_files:/var/www/html/phpBB3/files
- phpbb_images:/var/www/html/phpBB3/images
- phpbb_store:/var/www/html/phpBB3/store
- phpbb_ext:/var/www/html/phpBB3/ext
- phpbb_styles_crossfire:/var/www/html/phpBB3/styles/crossfire
Without these volumes, all data is lost when the container is removed.
Note what's not covered: the rest of styles/ (including the stock Prosilver
style) isn't persisted, so any change made directly to styles/prosilver/...
is lost on the next rebuild — this is what happened in
issue #7. For
custom branding (a logo, colors, etc.), create a child style that inherits
from Prosilver — e.g. one named crossfire — through phpBB's ACP
(Customise → Styles → Manage styles), and set it as the default style.
Files under a child style's own directory land on the
phpbb_styles_crossfire volume and survive upgrades; the stock prosilver
style stays upgradable.
Only these are actually read by something in this repo. See .env.sample for the full list with example values.
| Name | Read by | Description |
|---|---|---|
MYSQL_ROOT_PASSWORD | mysql container (official image) | MySQL root password. |
MYSQL_HOST | mysql container | Hostname the mysql container advertises. |
MYSQL_HOST_PORT | mysql container | Host-side port mapped to MySQL. Default 3306. |
MYSQL_DATABASE | mysql container | Database created on first boot. |
MYSQL_USER | mysql container | Non-root MySQL user created on first boot. |
MYSQL_PASSWORD | mysql container | Password for MYSQL_USER. |
ALLOW_EMPTY_PASSWORD | mysql and phpbb containers | Allow an empty MySQL root password. Default no. |
PHPBB_DATABASE_HOST | not read by the image | For your own reference; type the same value into phpBB's installer. |
PHPBB_DATABASE_PORT_NUMBER | not read by the image | Same. |
PHPBB_DATABASE_NAME | not read by the image | Same. |
PHPBB_DATABASE_USER | not read by the image | Same. |
PHPBB_DATABASE_PASSWORD | not read by the image | Same. |
APACHE_SERVER_ADMIN | php/Dockerfile build ARG, not runtime | Bakes the Apache ServerAdmin address in at build time. The published Docker Hub image is built without this set, so it's a no-op unless you build the image yourself with --build-arg APACHE_SERVER_ADMIN=.... |
DOMAIN | traefik/compose.yml | Passed into the traefik container's environment. |
TZ | all containers | Container timezone. |
SYSLOG_ADDRESS | compose.yml, traefik/compose.yml | Remote syslog endpoint for container logs. |
Container logs go to stdout:
docker compose logs phpbb
docker compose stop phpbb
docker run --rm \
-v /path/to/phpbb-backups:/backups \
--volumes-from phpbb \
busybox cp -a /var/www/html/phpBB3 /backups/latest
compose.ymldocker compose up -dFROM basictheprogram/crossfire-phpbb3:latest
USER 0
RUN apt-get update && apt-get install -y --no-install-recommends vim \
&& rm -rf /var/lib/apt/lists/*
USER www-data
This image downloads and ships phpBB3, which is distributed under the GNU General Public License, Version 2.
The GPL v2 requires that the phpBB3 source be made available to recipients of this image. The unmodified phpBB3 source is available at the upstream GitHub repository linked above. This project's own files (Dockerfile, scripts, configuration) are licensed separately under the MIT License — see LICENSE.md.
Bob Tanner, maintained by Rick Tanner.
This project's own files (Dockerfile, scripts, configuration) are licensed under the MIT License — see LICENSE.md. phpBB3 itself is distributed separately under GPL v2 — see Third-party software.
File an issue at https://github.com/crossfire-projects/docker-phpbb/issues.
Content type
Image
Digest
sha256:2b4c48fc0…
Size
192 MB
Last updated
11 days ago
docker pull basictheprogram/crossfire-phpbb3