Introducing WP Docker
Back in 2013, 10up introduced Varying Vagrant Vagrants (VVV), a project led by then 10upper Jeremy Felt. One of the first popular WordPress development environments based on Vagrant, VVV has since been moved out of 10up’s GitHub and into its own, where it continues to thrive as a community-led project.
Now, Docker and container-based server architectures have emerged as powerful tools for creating and managing development environments. Last year, we partnered with Joyent to release a scalable, production-ready Docker environment for WordPress. Today, we’re proud to release WP Docker: an open source Docker configuration optimized for local WordPress development.
Why WP Docker?
While still viable, VVV, Vagrant, and Virtual Box/Hyper-V take up extreme disk space and are slow to provision, start up, and SSH into. Because of this, engineers tend to use one “mega” VVV install for all of their development websites. This workflow poses a number of problems: system service version and configuration “normalization” across all projects (i.e. PHP 7 on everything when some projects run PHP 5.6 in production), and legacy clutter (i.e. old websites and system packages undeleted).
WP Docker addresses these shortcomings and provides greater flexibility in environment creation and distribution. Since Docker starts up extremely quickly, the environment is conducive to a “one site per environment” rule. Docker Compose makes it easy to swap system package versions and configurations. An engineer can easily use PHP 5.6 for one environment and PHP 7 for another. Docker Compose also simplifies adding new dependencies (e.g. MongoDB). As an added bonus, WP Docker includes Elasticsearch, so ElasticPress works out-of-the-box.
Our lightweight WP Docker project includes:
- PHP7
- MariaDB
- NGINX
- Elasticsearch
- Gearman
- Memcached
That said, we don’t believe in “one size fits all” engineering solutions, and that applies to development environments. 10up still uses VVV for quite a few projects. We think that WP Docker offers another powerful option for developing WordPress applications locally, and we are excited to share it with the open source community.
Vinod Dalvi on
Yes i have used it and it is easier to use than VVV.
Jason on
This is fantastic! Trying it out right now.
Trent Lapinski on
Way to use our name guys.
http://WPdocker.com already exists, and has for several years. We’re a white label Docker hosting solution for WordPress.
Ironically enough we could easily deploy your tech stack on our platform.
Jake Goldman on
The naming collision wasn’t intentional; while the name is extremely generic, I regret that we didn’t check for a conflict before releasing our open source project. We’ll discuss internally, and follow up.
Tom J Nowell on
Interesting, but a few inaccuracies. VVV 2 supports multiple versions of PHP, as well as only provisioning the sites you want, amongst other things:
https://varyingvagrantvagrants.org/docs/en-US/adding-a-new-site/changing-php-version/
https://varyingvagrantvagrants.org/docs/en-US/vvv-config/#skip_provisioning
Taylor Lovett on
Hey Tom, VVV 2 does support separate versions of PHP; this post was written with VVV 1 in mind, which was the current version when we were finishing WP Docker. That said, docker-compose still provides much more flexibility in defining environments e.g. versions of MariaDB, Elasticsearch. Although I haven’t spent much time with VVV 2 yet, the dependency on Vagrant can still cause some slowness.
David Dumonde on
I’m very eager to try this, as I haven’t been very successful setting up Docker for WP. One point of confusion I have is handling multiple WP sites (not multisite). I’m used to running a LEMP stack on a VPS, with a few separate WP installs in separate folders in /var/www/html, so multiple sites are sharing the common nginx/mariadb/php resources. I know Docker’s one-process-per-container principle, but it seems that using docker-compose, I need to create separate nginx/mariadb/php containers for every additional wp install. Am I misunderstanding this? Or is there a way to set up one set of nginx/mariadb/php and one wp container per site and have them all work together harmoniously? Thanks for any light you can shed on this puzzle I’ve had for months.
Travis on
Also curious about this! What’s the process / best way to do multiple sites?
Roope on
As I have understood, you have one docker image from each service, so in your example three images. Then you start three docker containers for each project you are running.
Debabrata Karfa on
Do the PHPUnit come with it?
Ben Bowler on
Any plan to support PHP 8 / version switching in future.
Jeff Paul on
Ben – that’s not currently on the roadmap nor discussed as an open enhancement request. So if that’s something of particular interest for you, then please open an enhancement issue for that and we can all discuss on GitHub how best to approach this.
Thanks!
Jeff.