A flexible Docker image for MyBB forum software that supports any version of MyBB.
- 🐳 Easy deployment with Docker or Docker Compose
- 🔄 Support for any MyBB version (configurable)
- 💾 Persistent data storage with Docker volumes
- 🔒 Secure default configuration
- 🚀 Optimized PHP configuration for MyBB
- ⬆️ Safe upgrade mode preserving configs, uploads, themes, and plugins
- ❤️ Health checks for container orchestration
- 📂 Optional SFTP server for file management (themes, plugins, updates)
- 📦 Optional phpMyAdmin for database management
There's an example Docker compose file in this repo, which pulls this image.
-
Build the image:
docker build -t mybb . -
Create a network:
docker network create mybb-network
-
Start MariaDB:
docker run -d \ --name mybb-db \ --network mybb-network \ -e MYSQL_ROOT_PASSWORD=root_password \ -e MYSQL_DATABASE=mybb \ -e MYSQL_USER=mybb \ -e MYSQL_PASSWORD=mybb_password \ -v mybb_db_data:/var/lib/mysql \ mariadb:10.11
-
Start MyBB:
docker run -d \ --name mybb-forum \ --network mybb-network \ -p 8080:80 \ -e MYBB_VERSION=1839 \ -e DB_HOST=mybb-db \ -e DB_USER=mybb \ -e DB_PASSWORD=mybb_password \ -e DB_NAME=mybb \ -v mybb_data:/var/www/html \ mybb
-
Access MyBB at http://localhost:8080
-
(Optional) Start SFTP server:
docker run -d \ --name mybb-sftp \ --network mybb-network \ -p 2222:22 \ -v mybb_data:/home/mybb/mybb \ atmoz/sftp \ mybb:your_password:33:33:mybb
| Variable | Description | Default |
|---|---|---|
MYBB_VERSION |
MyBB version number (e.g., 1839) | 1839 |
MYBB_PORT |
Web server port | 8080 |
DB_HOST |
Database hostname | - |
DB_PORT |
Database port | 3306 |
DB_USER |
Database username | root |
DB_PASSWORD |
Database password | - |
DB_NAME |
Database name | mybb |
FORCE_REINSTALL |
Force reinstall MyBB | false |
SFTP_PORT |
SFTP server port | 2222 |
SFTP_USER |
SFTP username | mybb |
SFTP_PASSWORD |
SFTP password | mybb_sftp_pass |
PMA_PORT |
phpMyAdmin port | 8081 |
TZ |
Timezone | UTC |
UPGRADE_MODE |
Enable safe upgrade mode | false |
PRESERVE_PLUGINS |
Keep plugins during upgrade | true |
PRESERVE_THEMES |
Keep themes during upgrade | true |
You can use any MyBB version by setting MYBB_VERSION in your .env file. The version is downloaded at container startup.
Find all available versions at: https://github.com/mybb/mybb/releases
The following volumes are created for data persistence:
| Volume | Path | Description |
|---|---|---|
mybb_data |
/var/www/html |
Complete MyBB installation (shared with SFTP) |
mybb_db_data |
/var/lib/mysql |
Database files |
mybb_sftp_keys |
/etc/ssh/keys |
SFTP server host keys (persistent identity) |
SFTP allows you to manage MyBB files directly - upload themes, install plugins, edit templates, or perform manual updates.
# Start with SFTP only
docker compose --profile sftp up -d
# Or start with all tools (SFTP + phpMyAdmin)
docker compose --profile tools up -dUse any SFTP client (FileZilla, WinSCP, Cyberduck, or command line):
# Command line
sftp -P 2222 mybb@localhost
# Connection details
Host: localhost (or your server IP)
Port: 2222 (or your SFTP_PORT)
Username: mybb (or your SFTP_USER)
Password: (your SFTP_PASSWORD from .env)After connecting, your files are located at:
/home/mybb/mybb/
├── admin/ # Admin control panel
├── cache/ # Cache files
├── images/ # Forum images
├── inc/ # Core includes & config
├── install/ # Installation files (delete after setup!)
├── jscripts/ # JavaScript files
├── uploads/ # User uploads (avatars, attachments)
└── index.php # Main entry point
Upload a theme:
put -r mytheme/* /home/mybb/mybb/images/mytheme/
Install a plugin:
put myplugin.php /home/mybb/mybb/inc/plugins/
Backup configuration:
get /home/mybb/mybb/inc/config.php ./config.php.backup
| Variable | Description | Default |
|---|---|---|
SFTP_PORT |
SFTP server port | 2222 |
SFTP_USER |
SFTP username | mybb |
SFTP_PASSWORD |
SFTP password | mybb_sftp_pass |
To enable phpMyAdmin for database management:
docker compose --profile tools up -dAccess phpMyAdmin at http://localhost:8081
After starting the containers, complete the MyBB setup:
-
Navigate to http://localhost:8080/install/
-
Follow the installation wizard
-
Database settings for Docker Compose:
- Database Engine: MySQL Improved
- Database Server Hostname:
mybb-db - Database Username:
mybb(or yourMYSQL_USER) - Database Password: Your
MYSQL_PASSWORD - Database Name:
mybb(or yourMYSQL_DATABASE) - Table Prefix:
mybb_(default)
-
After installation, delete the install folder:
docker exec mybb-forum rm -rf /var/www/html/install
This image includes a safe upgrade mode that preserves your configuration, uploads, themes, and plugins while updating MyBB core files.
-
Edit
.env- Set the new version and enable upgrade mode:MYBB_VERSION=1839 UPGRADE_MODE=true
-
Rebuild and restart:
docker compose down docker compose build --no-cache docker compose up -d
-
Complete the upgrade:
- Visit
http://localhost:8080/install/upgrade.php - Follow the upgrade wizard (this migrates your database)
- Visit
-
Cleanup:
# Remove the install folder docker exec mybb-forum rm -rf /var/www/html/install # Remove the upgrade reminder file docker exec mybb-forum rm -f /var/www/html/UPGRADE_IN_PROGRESS.txt # Disable upgrade mode in .env # UPGRADE_MODE=false (or remove the line)
| Item | Preserved | Notes |
|---|---|---|
inc/config.php |
✅ Always | Database configuration |
inc/settings.php |
✅ Always | Forum settings |
uploads/ |
✅ Always | User avatars, attachments |
inc/plugins/ |
✅ Default | Set PRESERVE_PLUGINS=false to reset |
images/ |
✅ Default | Set PRESERVE_THEMES=false to reset |
inc/languages/ |
✅ Always | Language customizations |
- All core PHP files
- JavaScript files
- Default images/icons
- Install/upgrade scripts
| Variable | Description | Default |
|---|---|---|
UPGRADE_MODE |
Enable safe upgrade mode | false |
PRESERVE_PLUGINS |
Keep existing plugins | true |
PRESERVE_THEMES |
Keep existing themes | true |
Before upgrading, the script automatically backs up critical files to /var/www/html/admin/backups/:
pre_upgrade_TIMESTAMP_config.phppre_upgrade_TIMESTAMP_settings.phppre_upgrade_TIMESTAMP_plugins_list.txtpre_upgrade_TIMESTAMP_themes_list.txt
For extra safety, create a full backup before upgrading:
# Backup files
docker exec mybb-forum tar -czvf /tmp/mybb-backup.tar.gz /var/www/html
docker cp mybb-forum:/tmp/mybb-backup.tar.gz ./mybb-backup.tar.gz
# Backup database
docker exec mybb-database mysqldump -u mybb -p mybb > mybb-database-backup.sqlIf you prefer manual control, use SFTP:
- Download new MyBB from mybb.com
- Connect via SFTP (see SFTP section above)
- Upload new files, but skip
inc/config.php - Visit
/install/upgrade.php - Delete the install folder
# Check logs
docker logs mybb-forum
# Check database logs
docker logs mybb-db# Fix permissions manually
docker exec mybb-forum chown -R www-data:www-data /var/www/html
docker exec mybb-forum chmod -R 755 /var/www/html
docker exec mybb-forum chmod -R 777 /var/www/html/uploads /var/www/html/cache- Ensure the database container is healthy:
docker ps - Verify credentials in
.envmatch the installation wizard inputs - Check if the network is properly configured
docker run -d \
--name mybb-forum \
-e FORCE_REINSTALL=true \
...- Change default passwords in
.env(database, SFTP) - Use HTTPS with a reverse proxy (nginx, Traefik, Caddy)
- Remove install folder after setup
- Regular backups of volumes
- Keep MyBB updated with security patches
- Restrict SFTP access - only expose port 2222 when needed, or use firewall rules
- Use SSH keys for SFTP instead of passwords (mount keys to
/home/user/.ssh/keys/)
This Docker configuration is provided as-is. MyBB itself is licensed under the LGPL v3.
Contributions are welcome! Please submit issues and pull requests.