Skip to content
Boilerplate for WordPress Development Projects
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Author: Edwin Velez
Author URI:
Project URI: WordPress Docker Boilerplate

When starting a new WordPress project there are several steps I find to be repetitive. In an attempt to minimize this repetition, I created a boilerplate that leverages the use of Docker Containers. You can download this boilerplate on my GitHub account.


Replace in the .env file with a value of your choice. This value is used to:

  1. Create a database in the **mariadb** Container.
  2. Configure the WordPress Container to use the newly created database.
  3. Name Docker Containers for easy identification.

NOTE: The MariaDB Container is simply named mariadb.

Reasoning for MariaDB Container Name

The MariaDB Container is simply named mariadb and takes just over 350MB of disk space brand new. Rather that create a new Docker Containers for each WordPress project, I manually create a new database on the same Container. To do this I use a database management tool such as DataGrip from JetBrains to authenticate as the root user as defined in the docker-compose.yml file. Of course you can use any other favorite tool of your choice. Rather than creating a new username and password for the new database created I use the same as the one that already exists. Because this is intended for local development only, using this method is not much of a problem. When the project is migrated to production then appropriate changes will be needed.

Create a Database

Make sure the mariadb Docker Container is running. Using your database management tool of choice, authenticate as the root user. Then create a new database accordingly. In the example below the default username of wordpress is used. If this is the second or higher database created on the existing Container, the user will already exist and be assigned a password. All that is left next is to grant the user privileges to the new database.

GRANT ALL PRIVILEGES ON ''.* TO 'wordpress'@'%';

Default User Information

Both the WordPress and MariaDB Docker Containers make use of variables. Below are their default values.


- MYSQL_ROOT_PASSWORD=root_password
- MYSQL_USER=wordpress
- MYSQL_PASSWORD=wordpress



What's Next?

Next I want WP CLI to automatically complete the post database creation process rather than manually entering initial site information data. WP CLI should also automatically install and activate any plugins I will needed for development. For example, if needed, WooCommerce should automatically be installed and activated as a ready to use plugin without further manual intervention.

You can’t perform that action at this time.