A few months ago I tested Docker to manage my development environments. The major advantage of Docker is to be able to develop locally on the same technical basis of the server. Admit that it’s tempting when you have sites hosted by different providers (even if most of them for my case are at O2Switch ) with different software versions of PHP, Mysql, Mariadb. The major drawback of Docker, in my humble opinion, is the complexity of configuration! I had never managed to run several vhosts at the same time!

With Lando, it’s easy!

While chatting with a colleague on the French WordPress Slack, I discovered Lando.

To use Lando, you first need to install Docker, then Lando comes as an overlay. It will greatly facilitate the configuration of the different Docker images to use to run your environment.

WordPress Recipes!

Lando offers “Recipes”, literally recipes for the main CMS and Frameworks on the market, including WordPress.

With the WordPress recipe, Lando will create an environment including PHP, and Mariadb to run your site but also wp-cli!

In short, in a few seconds of launching, you are ready to develop on your favorite CMS.

A simplified configuration for Docker!

Here is an example of the .lando.yml configuration file that you will need to have at the root of your project to launch your Lando instance!

name: test
recipe: wordpress
config:
  webroot: .
  php: '7.0'
  xdebug: true
  database: mariadb
services:
  pma:
    type: phpmyadmin
    hosts:
      - database
      - old-test
  mailhog:
    type: mailhog
    hogfrom:
    - appserver
  old-test:
    type: mariadb
    portforward: true
    creds:
      user: wordpress
      password: wordpress
      database: old-test
tooling:
  compose:
    service: appserver

This is a simple text file in .yml format that will be read by Lando to create your environment.

Note a “name”, this one will be used to create your local development url! as well as the services you want to create and in which version! Here I chose a PHP version 7.0, Mariadb in its current stable version, Phpmyadmin, Mailhog to “catch the mails” without having a mail server to configure. There is also the configuration of a second ‘old-test’ database server, the activation of Xdebug and Composer! Lando on Github

Leave a Reply

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