In this tutorial we're going to investigate what is the quickiest and easiest way of getting a WordPress site up and running for development.
In the past in order to have a WordPress development site you would need to install Apache/Nginx, MySQL and PHP and having these running on your local machine before you can even install WordPress.
The easiest way of getting WordPress running locally is by using
docker-compose. This allows you to have a development site running in seconds.
There is a docker image that will install the latest version of WordPress within an container, which means you don't even have to download the latest version of WordPress. You just spin up the docker container and you have everything you need to get the site running.
Using docker compose means we can also have a database running to install the WordPress site in seconds.
Start a new project in your IDE and create a
docker-compose.yml file and add the following.
Then you can create the
wp-content folder in the root of your project with a
plugins folder inside.
By assigning these folders to volumes on your WordPress image you can create new plugins and themes and they will go into the docker container to be used by WordPress.
volumes: - ./wp-content/themes:/var/www/html/wp-content/themes/ - ./wp-content/plugins:/var/www/html/wp-content/plugins/
docker-compose up -d and your local WordPress environment will be available at