This repository provides a stable and working docker-compose setup for Flarum, based on the popular mondedie/flarum configuration, but updated and fixed for a modern Flarum environment.
This repository uses a flexible Dockerfile, allowing you to build specific Flarum versions. The following releases are tested configurations.
- v2.0.0-beta.3 (Beta) - Dockerfile
- v1.8.10 (Stable) - Dockerfile
- Multi-platform image:
linux/amd64,linux/arm64 - Lightweight & secure image based on Alpine Linux 3.18
- Nginx and PHP 8.2
- Configurable Flarum version
- MariaDB driver
- OPCache extension configured
- The container exposes port 8888 for Flarum. You can map this to any port on your host.
/flarum/app/public/assets: Flarum assets directory./flarum/app/storage/logs: Flarum logs directory./flarum/app/extensions: A control directory for managing extensions./flarum/app/packages: An optional volume for local extender development.
| Variable | Description | Type | Default value |
|---|---|---|---|
| UID | Flarum user id | optional | 991 |
| GID | Flarum group id | optional | 991 |
| DEBUG | Flarum debug mode | optional | false |
| FORUM_URL | Your forum's public URL | required | http://localhost:8080 |
| DB_HOST | MariaDB instance ip/hostname | optional | mariadb |
| DB_USER | MariaDB database username | optional | flarum |
| DB_NAME | MariaDB database name | optional | flarum |
| DB_PASS | MariaDB database password | required | some_secure_password |
| DB_PREF | Flarum tables prefix | optional | none |
| DB_PORT | MariaDB database port | optional | 3306 |
| FLARUM_PORT | Port to run Flarum on inside the container | optional | 8888 |
| UPLOAD_MAX_SIZE | The maximum size of an uploaded file | optional | 50M |
| PHP_MEMORY_LIMIT | PHP memory limit | optional | 128M |
| OPCACHE_MEMORY_LIMIT | OPcache memory size in megabytes | optional | 128 |
| LOG_TO_STDOUT | Enable nginx and php error logs to stdout | optional | false |
| GITHUB_TOKEN_AUTH | Github token to download private extensions | optional | false |
| PHP_EXTENSIONS | Install additional php extensions (space separated) | optional | none |
| Variable | Description | Type | Default value |
|---|---|---|---|
| FLARUM_ADMIN_USER | Name of your admin user | required | admin |
| FLARUM_ADMIN_PASS | Admin user password | required | another_strong_password |
| FLARUM_ADMIN_MAIL | Admin user email address | required | admin@example.com |
| FLARUM_TITLE | Set the name of your forum | optional | My Flarum Forum |
git clone https://github.com/kitbur/docker-flarum.git
cd docker-flarumCopy the example compose file to create your own local configuration.
cp docker-compose.yml.example docker-compose.ymlEdit the environment: section to set your own secure passwords, forum title, admin user, public URL, and any other configurations you want.
Build your Flarum image and start all services.
docker-compose up -d --buildYour forum will be live at the FORUM_URL you configured. Visit the site and log in with your database credentials, as well as the FLARUM_ADMIN_USER and FLARUM_ADMIN_PASS you set in the docker-compose.yml file.
This project is released under the MIT License.
