DEV Community

Cover image for Setting up your WordPress development environment in Docker
Prappo
Prappo

Posted on

Setting up your WordPress development environment in Docker

Prerequisites

Assuming you already know how to use docker and basics of WordPress theme and plugin developments.
If you already don't know much you can check the following links.

Goals

This is good practice not to touch WordPress core. All of our works will based on themes and plugins folders. So we will make a system where themes and plugins folders are accessible from out side of container so that if we change the plugin or theme code then the effect will be applied immediately on development site.

Steps

  • Let's create docker-compose.yml file in our development folder.
  • Define the services.
  • Run docker-compose up command to up and running our development environment.

Creating docker-compose.yml and defining services

For our development process we need three services container

  • Database ( MySQL )
  • WordPress
  • phpmyadmin ( database browser )

phpmyadmin is optional we are using this if we need to browse the data for development purpose. You can skip it if you want.

Let's see how we can define these services.
Edit the `docker-compose.yml' file and follow the steps.

  • Define the docker compose version at the very top like this

version: "3.3"

  • Define database container

image

  • Define WordPress container

image

  • Define Phpmyadmin container

image

Full docker-compose.yml code

Top comments (0)