DEV Community

Cover image for Docker environment for WordPress development

Docker environment for WordPress development

Sarah Siqueira on July 06, 2023

A little while ago, I wrote about the reasons why I changed from XAMPP to Docker, back then I shortly describe my actual Docker WordPress environme...
Collapse
 
dasnow profile image
das-now

Hi Sarah,

Thank you for good guide. I would like to add one thing. In my case WordPress Health said that REST API is not working. As I've found the reason was that it try to connect not from outside, but from inside.
In file docker-compose.yml you have port mapping settings for WordPress section:

wordpress:
...
ports:
      - ${WORDPRESS_PORT}:80
Enter fullscreen mode Exit fullscreen mode

If we have in .env file

WORDPRESS_PORT=8000
Enter fullscreen mode Exit fullscreen mode

so REST is sending requests to 8000 port, and can't reach WP.
The solution: before running docker-compose up -d commandset in .env

WORDPRESS_PORT=80
Enter fullscreen mode Exit fullscreen mode
Collapse
 
sarahcssiqueira profile image
Sarah Siqueira

Thanks for notice and reporting it @dasnow, I updated this post and the repository as well: github.com/sarahcssiqueira/docker-...