Lando, Docker, Development – Discover quickly the potential of Lando with a simple WordPress install

I was looking for the shortest way to learn something about Docker. I have heard a lot of praise about Docker and the opportunity it gives to build up any development environment in a snap of fingers.

The principle of Docker is containerization, so you can build any specific virtual environment that you want : a certain version of PHP with MySQL plus any version of a CMS such as WP, Drupal or a framework such as Symfony or Laravel and share it with anyone.

It is a very good alternative to a local desktop server such as MAMP or XAMPP where everything is almost set by default.

For me, the purpose was to use Docker to install WordPress and withdraw definitively from MAMP. I want to stop working on a non scalable and non shareable environment. I still wanted to have a local environment but easily shareable on a global scale!!! To mock the marketing antiphon, I wanted to “think global, develop local”.

I have tried Docker, definitely it is cool but I had to search on Google to answer to the question “Where the heck are the WordPress’s files when you install it through Docker?” So meanwhile looking for Docker, I bumped into Lando. Thanks to FOG who has given me the itch to discover this program Lando.

Lando correspond much more to what I was looking for. It is the tool to manage your dev environments.
Relying on Docker, Lando raises the level of assistance higher for what they call in their documentation “RECIPES”. You can virtually build any development environment you want from WordPress to Node passing by Drupal 6, Drupal 7, Drupal 8, Joomla, Laravel, LAMP…etc.

Here is a quick way to use Lando to install WordPress.

Installing Lando

Let’s do the easy way by following the step by step given by Lando itself.

In few lines, the way you can install WordPress with Lando in a directory name my_wp_lando_2. It will create a .lando.yml file

$ cd /the-path-to-your-lando-install/
$ mkdir my_wp_lando_2
$ cd my_wp_lando_2
$ lando init --recipe=wordpress --vv
$ lando wp core download

Discover quickly the potential of Lando with WordPress install

To launch, the installation, you have to be in the correct directory.

$ lando start

Discover quickly the potential of Lando with WordPress install

Launching the WordPress Install

Discover quickly the potential of Lando with WordPress install

In order to fill up the form for the WP install operation

dbname:wordpress
username:wordpress
password:wordpress
dbname_host:database

Discover quickly the potential of Lando with WordPress install

Change your installation

I have decided to change my installation and add to this lando’s container, phpmyadmin. I will just have to edit the file .lando.yml at the root of my directory.

name: my-wp-lando-app
recipe: wordpress
config:
  webroot: .
  database: mysql
services:
  pma:
    type: phpmyadmin
    host:
      - database

The name of my application is my-wp-lando-app. As I have changed enough the .lando.yml file, I am force to rebuild my application.

#If you change more deeply the .lando.yml file, you will be forced to rebuild
$ lando rebuild
 
 
#To stop from inside of an app directory
$ lando stop
 
#To start from inside of an app directory
$ lando start

There is a new url for the phpmyadmin
Discover quickly the potential of Lando with WordPress install

You can check the WP database
Discover quickly the potential of Lando with WordPress install

Physically, the files are accessible via your favourite editor. You can add plugins, edit themes… etc… If you kill your application, the files will remain in your Lando directory.

Discover quickly the potential of Lando with WordPress install

Other useful commands in Lando

Some other commands that you should know.

If you want the complete information about your application

$ lando info

Some other command to stop, restart…etc.

#If you only add a service
$ lando restart
 
#To stop from inside of an app directory
$ lando stop
 
#To start from inside of an app directory
$ lando start
 
#To stop from outside of an app directory
lando stop my-wp-lando-app
 
#To start from outside of an app directory
lando start my-wp-lando-app
 
#To kill from inside of an app directory. My app name is my-wp-lando-app
$ lando destroy my-wp-lando-app

Conclusion: Lando is a great tool that simplify the usage of Docker. The documentation is very well done. You can take it in hand without difficulties. No headache to understand how to make evolution in some of your containers.

Read more