This guide walks you through deploying WordPress with MariaDB to Magic Containers. You can deploy using a one-click template or configure the containers manually.Documentation Index
Fetch the complete documentation index at: https://docs.bunny.net/llms.txt
Use this file to discover all available pages before exploring further.
This is a starter guide intended to show how quickly a real workload can run
on Magic Containers. It’s aimed at developers comfortable customising Docker
images, working with environment variables and volumes, and making changes to
a WordPress install at the file level. A production-grade WordPress deployment
will need additional hardening, image tuning, backup, and caching decisions
beyond what’s covered here.
Deploy with a template
The fastest way to get WordPress running is to use the built-in template, which pre-configures WordPress and MariaDB with persistent volumes.Open the WordPress template
In the bunny.net dashboard, go to Magic Containers and open the WordPress template.
Configure environment variables
The template includes pre-configured environment variables for WordPress and MariaDB. Review and update passwords as needed before deploying.
Deploy manually
If you prefer to configure everything yourself, follow these steps.Create a new app
Go to the bunny.net dashboard, select Magic Containers, and click Add App. Select Single region deployment.
Add the WordPress container
Click Add Container and configure the image:
- Registry: Docker Hub
- Image:
library/wordpress - Tag:
apache
| Variable | Value |
|---|---|
WORDPRESS_DB_HOST | 127.0.0.1 |
WORDPRESS_DB_USER | wordpress |
WORDPRESS_DB_PASSWORD | a strong password |
WORDPRESS_DB_NAME | wordpress |
Add a volume for WordPress content
In the Volumes section of the WordPress container, add a volume:
- Name:
wp-content - Mount path:
/var/www/html/wp-content
Add the MariaDB container
Click Add Container and configure a second container:
- Registry: Docker Hub
- Image:
library/mariadb - Tag:
latest
| Variable | Value |
|---|---|
MARIADB_ROOT_PASSWORD | a strong root password |
MARIADB_USER | wordpress |
MARIADB_PASSWORD | same password as WORDPRESS_DB_PASSWORD |
MARIADB_DATABASE | wordpress |
Add a volume for MariaDB
In the Volumes section of the MariaDB container, add a volume:
- Name:
mariadb-data - Mount path:
/var/lib/mysql
Add an endpoint
Go to the Endpoints tab, click Add New Endpoint, and set the container port to
80. Select the WordPress container.Set the site URL
After deploying, copy the WordPress endpoint URL from the Endpoints tab (e.g.
This prevents WordPress from auto-detecting the wrong URL, which can happen in multi-container setups where multiple endpoints exist. Redeploy after adding these variables.
https://mc-xxx.bunny.run). Go to the WordPress container’s Environment Variables and add:| Variable | Value |
|---|---|
WP_HOME | your WordPress endpoint URL |
WP_SITEURL | same as WP_HOME |
Complete the installation
If you plan to use a custom domain, add it to your WordPress endpoint and
update
WP_HOME and WP_SITEURL before running the installation wizard.
WordPress stores the site URL during installation, and completing setup on the
default mc-xxx.bunny.run URL means you’ll need to update it later. See Add
a custom hostname for details.- Select your language
- Set the site title
- Create an admin account
- Complete the installation
Environment variables
The WordPress container supports these key environment variables:| Variable | Description |
|---|---|
WORDPRESS_DB_HOST | Database host (use 127.0.0.1 for multi-container) |
WORDPRESS_DB_USER | Database username |
WORDPRESS_DB_PASSWORD | Database password |
WORDPRESS_DB_NAME | Database name |
WORDPRESS_TABLE_PREFIX | Table prefix (default: wp_) |
WORDPRESS_DEBUG | Enable debug mode (1 or 0) |
WP_HOME | Full URL of the site (e.g. https://mc-xxx.bunny.run) |
WP_SITEURL | Full URL where WordPress is installed (usually same as WP_HOME) |
Persistent volumes
The WordPress template uses two persistent volumes:| Volume | Mount path | Purpose |
|---|---|---|
wp-content | /var/www/html/wp-content | Themes, plugins, and uploads |
mariadb-data | /var/lib/mysql | Database files |
Always set strong passwords for database credentials, even if the database is
not exposed externally. Other containers in the same pod can access the
network, and a password protects against accidental or unauthorized access.
Manage files with File Browser
Since Magic Containers don’t yet provide SSH access, you can temporarily add File Browser as a sidecar container when you need to inspect files, copy something out, or run a manual procedure that can’t be done from WordPress admin (for example, editingwp-config.php, removing a broken plugin directory, or uploading a file that exceeds the WordPress upload limit).
Add the File Browser container
In your app settings, click Add Container and configure:
- Registry: Docker Hub
- Image:
filebrowser/filebrowser - Tag:
latest
80, configure File Browser to listen on a different port by setting the following environment variable:| Variable | Value |
|---|---|
FB_PORT | 8085 |
Mount the wp-content volume
In the Volumes section, mount the same
wp-content volume used by the WordPress container:- Name:
wp-content - Mount path:
/srv
/srv by default, so this gives it access to your WordPress themes, plugins, and uploads.Add an endpoint
Go to the Endpoints tab and add a new endpoint for the File Browser container on port
8085.Capture the generated password from the logs
Open your app and go to the Logs tab as it deploys. On first boot, File Browser prints a line similar to:The password is shown once. If you miss it, redeploy the container to generate a new one.
Log in
Open the File Browser endpoint URL in your browser and sign in:
- Username:
admin - Password: the value you copied from the logs
Add a custom hostname
To use your own domain with WordPress:- Go to your app’s Endpoints tab
- Add a custom hostname to your CDN endpoint
- Update the
WP_HOMEandWP_SITEURLenvironment variables to your custom domain (e.g.https://example.com)