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.1
Open the WordPress template
In the bunny.net dashboard, go to Magic Containers and open the WordPress template.
2
Name your app
Give your application a name.
3
Configure environment variables
The template includes pre-configured environment variables for WordPress and MariaDB. Review and update passwords as needed before deploying.
4
Choose a region
Select the region where you want to deploy your application.
5
Deploy
Click Deploy to launch your WordPress site.
Deploy manually
If you prefer to configure everything yourself, follow these steps.1
Create a new app
Go to the bunny.net dashboard, select Magic Containers, and click Add App. Select Single region deployment.
2
Add the WordPress container
Click Add Container and configure the image:
- Registry: Docker Hub
- Image:
library/wordpress - Tag:
apache
3
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
4
Add the MariaDB container
Click Add Container and configure a second container:
- Registry: Docker Hub
- Image:
library/mariadb - Tag:
latest
5
Add a volume for MariaDB
In the Volumes section of the MariaDB container, add a volume:
- Name:
mariadb-data - Mount path:
/var/lib/mysql
6
Add an endpoint
Go to the Endpoints tab, click Add New Endpoint, and set the container port to
80. Select the WordPress container.7
Deploy
Review your settings and click Confirm and Create.
8
Set the site URL
After deploying, copy the WordPress endpoint URL from the Endpoints tab (e.g.
https://mc-xxx.bunny.run). Go to the WordPress container’s Environment Variables and add: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.
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:Persistent volumes
The WordPress template uses two persistent volumes:
Without these volumes, all data is lost when containers restart. See persistent volumes for more details.
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).
1
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:2
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.3
Add an endpoint
Go to the Endpoints tab and add a new endpoint for the File Browser container on port
8085.4
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.
5
Log in
Open the File Browser endpoint URL in your browser and sign in:
- Username:
admin - Password: the value you copied from the logs
6
Remove File Browser when you're done
Once you’ve finished, remove the File Browser endpoint and container from your app and redeploy. This closes off the publicly reachable login page and avoids leaving a long-lived tool exposed alongside your site.
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)