MyBB self-hosted forum on docker

Need a self-hosted Forum / Bulletin Board? MyBB is here to the rescue!

MyBB self-hosted forum on docker

This one was a request from my son where he asked for a platform to post his Roblox scripts and creations along with some troubleshooting help, so I happily obliged.

I used the official MyBB docker image to set it up and this time I switched to docker-compose since bringing up the 3 needed services is much faster that way.

The proposed docker-compose file on GitHub doesn't expose the database port to the host, so that gave me some initial trouble connecting MyBB to it but after adding a port mapping the MyBB setup continued without a hitch. Here's the modified version :

services:
  mybb:
    image: mybb/mybb:latest
    volumes:
    - ${PWD}/mybb:/var/www/html:rw

  nginx:
    image: nginx:mainline-alpine
    ports:
    - published: 8090
      target: 80
    volumes:
    - ${PWD}/nginx:/etc/nginx/conf.d:ro
    - ${PWD}/mybb:/var/www/html:ro

  postgresql:
    environment:
      POSTGRES_DB: mybb
      POSTGRES_PASSWORD: **yourpassword**
      POSTGRES_USER: mybb
    image: postgres:13.2-alpine
    ports:
    - published: 5433
      target: 5432
    volumes:
    - ${PWD}/postgres/data:/var/lib/postgresql/data:rw

version: '3.8'

Keep in mind that I changed the Postgres port on the host (published: 5433) since I'm already running another Postgres instance on the same machine and I want to keep that one isolated. I also changed the nginx host port to 8090 from the proposed 8080 since the former was also bound to another service, so what port you can accordingly.


Setting up the actual BB

One thing that bugged me with this container, that I guess was to be expected, is that all files in the installed directory of MyBB belong to the www-data user (number 82 on the host) and all the requested updates to files and installation of themes had to be sudo chown -r 82:82 * before installing them. Then again that's how web servers work, so I'm not complaining.