Develop WordPress Locally with Docker Tutorial

First, clone the git repo that I created (https://github.com/davidrichied/docker-template-php80-mysql8-nginx-ssl-wordpress). It has all the stuff.

git clone https://github.com/davidrichied/docker-template-php80-mysql8-nginx-ssl-wordpress.git mywp

Build the docker container

cd mywp

docker compose up -d –build

Next, you’ll have to install WordPress. I used brew to install wp-cli. Then, I just ran the following commands.

cd ~/Code/mywp/wordpress/public

wp core download –locale=en_US

Next copy the example config file I put in there. It has some important stuff in it, such as the correct database user and password and the correct host. Confusingly, the host matches the name of the docker service (database).

cp wp-config-docker.php wp-config.php

Now, you should be able to visit https://localhost and set up your WordPress site.