Using Lando with WSL2-enabled Docker

Heart with logos for Lando, Docker and WSL2

Lando is a wonderful tool for building various web applications that will later be run on native servers. At Hawke AI we use this tool for the development of some of our applications, such as OpenSong Library Online. However, recently Lando has announced that it is a “bad idea” to run your Windows-based Docker with WSL2 enabled, because it doesn’t play nice with the way Lando wants things done. The other side of this issue is that WSL2 will not always play nice with the http://localhost:12345 or the https://yoursite.lndo.site URLs that Lando supplies, usually timing out. If this happens, you can use the following method to make this work, which has been used on both Debian and Ubuntu flavors of WSL2. Thus, the commands below reflect those two versions.

Installing Lando Under WSL2 with Docker Desktop

To install Lando, download the latest .deb package to the WSL side of your system and run the dpkg command as follows:

sudo dpkg --ignore-depends=docker-ce --install lando-x64-vx.x.x.deb

It will install and you can then run all of Lando’s commands very nicely (e.g. lando start) as long as Docker Desktop is running in the tray on the Windows side (in WSL2 mode!).

Gotcha!

The main issue you will run into is when you do an apt update or apt install command. Before you run that command you will need to uninstall Lando with the following command:

sudo apt remove lando

Then you can run your apt commands and reinstall with the above command when you’re done. Otherwise you’ll see something like:

You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
...
lando : Depends: docker-ce but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

If you see this be sure to remove Lando before continuing.

Those who prefer Kali Linux or SUSE should be able to figure out the cognate commands to the Debian/Ubuntu ones.

Enjoy!