How to Easily Set Up Local Development with Lando and Docker
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
Download and Install Docker Desktop: Ensure Docker Desktop is installed and running on your Windows machine.
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
Download and Install Docker Desktop: Ensure Docker Desktop is installed and running on your macOS machine.
Install Lando using Homebrew:
Open a terminal.
Run the following commands to install Lando via Homebrew:
brew install lando
Installation on Linux
Download and Install Docker: Ensure Docker is installed and running on your Linux machine.
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
Create a Project Folder:
Open a terminal and create a new project folder:
mkdir myproject cd myproject
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
Configure the Lando Environment:
- Open the
.lando.yml
file in your project folder and customize it as needed.
- Open the
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].
Subscribe to my newsletter
Read articles from Tran Tuan directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Tran Tuan
Tran Tuan
As a seasoned Senior FullStack Web and Mobile Developer, I bring over 10+ years of extensive experience in designing, developing, and deploying robust applications across various platforms. My expertise spans a diverse range of technologies, including PHP, NodeJS, Flutter, ReactNative, VueJS, AngularJS, and ReactJS, enabling me to deliver comprehensive solutions that meet the dynamic needs of modern businesses.