How to Easily Set Up Local Development with Lando and Docker

How to Easily Set Up Local Development with Lando and Docker

·

3 min read

https://lando.dev/

Lando is a powerful, open-source, local development environment and DevOps tool built on Docker container technology. It simplifies the process of setting up and managing local development environments for various projects, making it an excellent choice for developers who want to streamline their workflows.

What is Lando?

Lando is designed to help developers quickly specify and spin up the services and tools needed for their projects. It supports a wide range of languages, frameworks, and services, providing an easy way to manage development dependencies and automate complex workflows. Lando is particularly useful for:

  • Mimicking production environments locally

  • Standardizing development environments across different operating systems

  • Integrating with hosting providers like Pantheon, Platform.sh, and Lagoon

  • Running CI tests locally and using a single development environment for multiple projects

Installation Steps

Prerequisites

Before installing Lando, ensure you have Docker installed on your system. Docker is a containerization platform that Lando relies on to create and manage development environments.

Installation on Windows

  1. Download and Install Docker Desktop: Ensure Docker Desktop is installed and running on your Windows machine.

  2. Install Lando using PowerShell:

    • Open a PowerShell terminal.

    • Run the following command to download and execute the Lando installation script:

        iex (irm 'https://get.lando.dev/setup-lando.ps1' -UseBasicParsing)
      
    • This script will install Lando and configure it to work with Docker Desktop and WSL2 (Windows Subsystem for Linux).

Installation on macOS

  1. Download and Install Docker Desktop: Ensure Docker Desktop is installed and running on your macOS machine.

  2. Install Lando using Homebrew:

    • Open a terminal.

    • Run the following commands to install Lando via Homebrew:

        brew install lando
      

Installation on Linux

  1. Download and Install Docker: Ensure Docker is installed and running on your Linux machine.

  2. Install Lando:

    • Open a terminal.

    • Run the following commands to download and install Lando:

        curl -fsSL https://get.lando.dev | bash
      

Getting Started with Lando

  1. Create a Project Folder:

    • Open a terminal and create a new project folder:

        mkdir myproject
        cd myproject
      
  2. Initialize a Lando Project:

    • Run the following command to initialize a Lando project with a specific recipe (e.g., WordPress):

        lando init --recipe wordpress --webroot wordpress --name myproject
      
  3. Configure the Lando Environment:

    • Open the .lando.yml file in your project folder and customize it as needed.
  4. Start the Lando Environment:

    • Run the following command to start the Lando environment:

        lando start
      
    • Lando will create the necessary Docker containers and provide a URL for accessing your project.

You could easy to fetch all current environments within a single command

Lando supports a wide range of services, which can be configured and managed through its .lando.yml file. Here are some of the services that Lando supports:

  • Web Servers: Apache, Nginx, Tomcat

  • Databases: MySQL, MariaDB, PostgreSQL, MongoDB, MSSQL

  • Programming Languages: PHP, Node.js, Python, Ruby, Go, .NET

  • Caching: Redis, Memcached

  • Search Engines: Elasticsearch, Solr

  • Mail: Mailhog

  • Other Tools: phpMyAdmin, Varnish

These services can be easily added to your Lando configuration to extend the functionality of your development environment.

Conclusion

Lando is a versatile tool that simplifies the process of setting up and managing local development environments. By following the installation steps outlined above, you can quickly get started with Lando and take advantage of its powerful features to streamline your development workflows. For more detailed information and advanced usage, refer to the official Lando documentation[2].