How to use Warden/Docker for WordPress development

I used the Warden CLI tool to orchestrate Magento (Adobe Commerce) environments for local development use.  Recently I needed to upgrade my blog and one other site, both based on WordPress. I realized that my old local development stack based on the Homebrew stopped working some time ago. This was the time to move to a more solid solution.

I thought that a Docker-based environment managed using Warden CLI would be the best fit for me. I dug into the Warden CLI documentation and source code and found out that a community member had already added support for the WordPress platform. It was not documented, though. I submitted a small PR for Warden Environment Types documentation and tested steps for local development.

If you want to use Warden CLI to run a Docker-based environment for WordPress, you can use the following steps:

1. Install the Warden CLI tool

2. Download the WordPress archive

3. Unpack WordPress code to the desired location, e.g., ~/Sites/myblog

4. Open a terminal and enter the directory that contains unpacked WordPress

5. Initialize WordPress environment – it will create a .env file:

warden env-init myblog wordpress

6. Sign SSL certificate:

warden sign-certificate myblog.test

7. Start the environment:

warden env up

8. Enter the shell of the php-fpm container:

warden shell

9. Copy sample WordPress config to the final location:

cp wp-config-sample.php wp-config.php

10. Edit wp-config.php and set the database name, username, and password to “wordpress”. Set the host to “db”.

11. Open the blog in the browser and finalize the installation – choose the site name and admin credentials: https://app.myblog.test/

That’s it! 🙂 Warden CLI tool is an easy way to run WordPress locally. It also includes some utilities that can make development easier: Traefik, Portainer, Dnsmasq, and MailHog. Check Warden Global Services documentation page to read more about them.

Leave a Comment

Your email address will not be published. Required fields are marked *