Windows Subsystem for Linux

docs.microsoft.com

Installation

Installation Guide for Windows 10

WSL 2

If your OS version is compatible, you should update to WSL 2: Updating the WSL 2 Linux kernel

Learn

Microsoft learn > Get started

Readings

Tips

  • Access Linux files from Windows system: open \\wsl$\Ubuntu\ in Windows Explorer (or %LOCALAPPDATA%\Packages\CanonicalGroupLimited.UbuntuonWindows*\LocalState\rootfs)

  • Access Windows files from Linux subsystem: go to /mnt/c/users/<username>

  • Configuration (\\wsl$\Ubuntu\etc\wsl.conf)

[automount]
options = "metadata"

[interop]
appendWindowsPath = false

Known issues

# temporary fix, to be run regularly
sudo hwclock -s
wsl --shutdown
  • Zombie process

ps axo stat,ppid,pid,comm | grep -w defunct
sudo kill -9 <pid>

Recipes

Kubernetes

Connect to Windows Minikube

  • In Windows, look at the kube config

kubectl config view
  • In Ubuntu, configure the kube context

kubectl config set-cluster minikube --server=https://127.0.0.1:<port> --certificate-authority=/mnt/c/Users/<username>/.minikube/ca.crt
kubectl config set-credentials minikube --client-certificate=/mnt/c/Users/<username>/.minikube/profiles/minikube/client.crt --client-key=/mnt/c/Users/<username>/.minikube/profiles/minikube/client.key
kubectl config set-context minikube --cluster=minikube --user=minikube
kubectl config use-context minikube
kubectl get nodes
kubectl version

Connect to Windows Docker (WSL 1)

  • In Docker settings, make sure to expose the daemon (in Settings > General > Expose daemon on tcp://localhost:2375 without TLS)

  • In Linux, make sure the DOCKER_HOST environment variable is set (echo $DOCKER_HOST => localhost:2375)

Theming

Last updated