DEV Community

Mircea Sirghi
Mircea Sirghi

Posted on • Updated on

Run Docker from WSL

Introduction

This article is a complete guide on how to setup WSL on windows and run docker, Kafka, Kubernetes commands directly from GitBash console without having to open WSL.

Additionally I have added the setup to use Java Test Containers.

The whole purpose is for anyone who wants to migrate to a new distribution or to change machines, or has to fix a broken WSL, in just a few steps the environment is prepared rapidly without the need to investigate the internet on each particular problem.

Preparing WSL with docker

First part is preparing windows to use docker from WSL without Docker Desktop.

Adding Java Test Containers

I observed that I can also automate the part to add Java Test Containers so this is the second part. So that anytime WSL gets broken or I want to switch to a new linux distribution or to change laptops, I can allway run the same commands and expect it works.

Setting up Kubernetes

Third part is how I setup Kubernetes through WSL.

Kafka setup

I will add setting up Kafka soon. Currently I am looking to change the whole approach to using just Kubernetes.

Note: I have removed scripts to enable docker on Powershell and CMD as I have never used them and find them redundant.

On Github

TBC

Top comments (0)