DEV Community

Cover image for How to setup Flarum in Docker
Harry Madgwick
Harry Madgwick

Posted on

How to setup Flarum in Docker

To begin

Pull from hub.docker.com
docker pull mondedie/flarum:latest

or build it manually
docker build -t mondedie/flarum:latest https://github.com/mondediefr/docker-flarum.git

Next setup the docker-compose.yml

version: "3"
services:
flarum:
image: mondedie/flarum:stable
container_name: flarum
env_file:
- /mnt/docker/flarum/flarum.env
volumes:
- /mnt/docker/flarum/assets:/flarum/app/public/assets
- /mnt/docker/flarum/extensions:/flarum/app/extensions
- /mnt/docker/flarum/storage/logs:/flarum/app/storage/logs
- /mnt/docker/flarum/nginx:/etc/nginx/flarum
ports:
- 80:8888
depends_on:
- mariadb
mariadb:
image: mariadb:10.5
container_name: mariadb
environment:
- MYSQL_ROOT_PASSWORD=xxxxxxxxxx
- MYSQL_DATABASE=flarum
- MYSQL_USER=flarum
- MYSQL_PASSWORD=xxxxxxxxxx
volumes:
- /mnt/docker/mysql/db:/var/lib/mysql

Customise the MYSQL settings to your setup!

Create a environment file (see docker-compose: /mnt/docker/flarum/flarum.env)

nano /mnt/docker/flarum/flarum.env

DEBUG=false
FORUM_URL=http://domain.tld
DB_HOST=mariadb
DB_NAME=flarum
DB_USER=flarum
DB_PASS=xxxxxxxxxx
DB_PREF=flarum_
DB_PORT=3306
FLARUM_ADMIN_USER=admin
FLARUM_ADMIN_PASS=xxxxxxxxxx
FLARUM_ADMIN_MAIL=admin@domain.tld
FLARUM_TITLE=Test flarum

Run your docker compose

docker-compose up -d mariadb
Wait a moment for the creation of the database
docker-compose up -d flarum

Top comments (0)