• Home
  • LLMs
  • Python
  • Docker
  • Kubernetes
  • Java
  • Maven
  • All
  • About
Kubernetes | Install & Use Docker Desktop with WSL 2
See these pages for more details on how to install Docker Desktop (WSL 2):
https://docs.docker.com/desktop/features/wsl/
https://learn.microsoft.com/en-us/windows/wsl/install

Make sure that you have installed Windows Subsystem for Linux (WSL 2): Install Windows Subsystem for Linux (WSL 2)

  • Install Docker Desktop on Windows:
    https://docs.docker.com/desktop/setup/install/windows-install/

  • Follow the installation instructions to install Docker Desktop.
    Once installed, Start Docker Desktop from the Windows Start menu.

  • Verify that the "Use WSL 2 based engine" is checked.
    In the Docker menu, select Settings, then select General.
    If not already checked, check the "Use the WSL 2 based engine" check box and click "Apply & Restart".

  • Check Docker-WSL integration.
    In the Docker menu, select Settings, then select Resources, then select "WSL INTEGRATION".
    Verify that the "Enable integration with my default WSL distro" is checked. If not already checked, check it.

    In the section "Enable integration with additional distro", select a distro of your choice.
    Click "Apply & Restart".

  • Enable Kubernetes.
    In the Docker menu, select Settings, then select Kubernetes.
    Check "Enable Kubernetes" check box.
    Check "Show system containers (advanced)" check box.
    Click "Apply & Restart".

  • Check Docker installation.

    docker version:
    $ docker version
    Client:
     Version:           28.0.4
     API version:       1.48
     ...
    
    Server: Docker Desktop 4.0.0 ()
     Engine:
      Version:          28.0.4
      API version:      1.48 (minimum version 1.24)
      ...
     containerd:
      Version:          1.7.26
      ...
     runc:
      Version:          1.2.5
      ...
     docker-init:
      Version:          0.19.0
      ...
    Let's run the nsenter command inside the debian container. We will get access to the Docker Desktop VM:
    $ docker container run --rm -ti --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh
    sh-5.2# cat '/etc/os-release'
    PRETTY_NAME="Docker Desktop"
    sh-5.2# ps -ef | grep dockerd
    root       143    82  8 18:00 pts/0    00:06:51 /usr/local/bin/dockerd --config-file /run/config/docker/daemon.json --containerd /run/containerd/containerd.sock --pidfile /run/desktop/docker.pid --swarm-default-advertise-addr=192.168.65.3 --host-gateway-ip 192.168.65.254
    root       407    82  0 18:00 pts/0    00:00:40 /usr/bin/cri-dockerd --docker-endpoint unix:///run/guest-services/cri-dockerd-proxy.sock --pod-infra-container-image registry.k8s.io/pause:3.10 --network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/var/lib/cni-plugins/bin
    root       506    82  3 18:00 pts/0    00:03:01 kubelet --kubeconfig=/etc/kubernetes/kubelet.conf --config /etc/kubeadm/kubelet.yaml --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --hostname-override=docker-desktop --container-runtime-endpoint unix:///var/run/cri-dockerd.sock
    sh-5.2# ls -1 /var/lib/docker/
    buildkit
    containers
    engine-id
    jfs
    network
    plugins
    rootfs
    runtimes
    stats
    swarm
    tmp
    volumes
  • Check Kubernetes installation.

    kubectl version:
    $ kubectl version
    Client Version: v1.32.3
    Kustomize Version: v5.5.0
    Server Version: v1.32.2
    docker images:
    $ docker images
    REPOSITORY                           TAG                                                     IMAGE ID       CREATED         SIZE
    docker/desktop-kubernetes            kubernetes-v1.19.7-cni-v0.8.5-critools-v1.17.0-debian   93b3398dbfde   3 months ago    285MB
    docker/desktop-storage-provisioner   v1.1                                                    e704287ce753   14 months ago   41.8MB
    docker/desktop-vpnkit-controller     v1.0                                                    79da37e5a3aa   15 months ago   36.6MB
    k8s.gcr.io/coredns                   1.7.0                                                   bfe3a36ebd25   11 months ago   45.2MB
    k8s.gcr.io/etcd                      3.4.13-0                                                0369cf4303ff   9 months ago    253MB
    k8s.gcr.io/kube-apiserver            v1.19.7                                                 c15e4f843f01   4 months ago    119MB
    k8s.gcr.io/kube-controller-manager   v1.19.7                                                 67b3bca112d1   4 months ago    111MB
    k8s.gcr.io/kube-proxy                v1.19.7                                                 9d368f4517bb   4 months ago    118MB
    k8s.gcr.io/kube-scheduler            v1.19.7                                                 4fa642720eea   4 months ago    45.6MB
    k8s.gcr.io/pause                     3.2                                                     80d28bedfe5d   15 months ago   683kB
    kubectl get all --all-namespaces:
    $ kubectl get all --all-namespaces
    NAMESPACE     NAME                                         READY   STATUS    RESTARTS   AGE
    kube-system   pod/coredns-f9fd979d6-47lqp                  1/1     Running   0          26h
    kube-system   pod/coredns-f9fd979d6-lk72n                  1/1     Running   0          26h
    kube-system   pod/etcd-docker-desktop                      1/1     Running   0          26h
    kube-system   pod/kube-apiserver-docker-desktop            1/1     Running   0          26h
    kube-system   pod/kube-controller-manager-docker-desktop   1/1     Running   0          26h
    kube-system   pod/kube-proxy-kmnmm                         1/1     Running   0          26h
    kube-system   pod/kube-scheduler-docker-desktop            1/1     Running   0          26h
    kube-system   pod/storage-provisioner                      1/1     Running   0          26h
    kube-system   pod/vpnkit-controller                        1/1     Running   0          26h
    
    NAMESPACE     NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)                  AGE
    default       service/kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP                  26h
    kube-system   service/kube-dns     ClusterIP   10.96.0.10   <none>        53/UDP,53/TCP,9153/TCP   26h
    
    NAMESPACE     NAME                        DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR            AGE
    kube-system   daemonset.apps/kube-proxy   1         1         1       1            1           kubernetes.io/os=linux   26h
    
    NAMESPACE     NAME                      READY   UP-TO-DATE   AVAILABLE   AGE
    kube-system   deployment.apps/coredns   2/2     2            2           26h
    
    NAMESPACE     NAME                                DESIRED   CURRENT   READY   AGE
    kube-system   replicaset.apps/coredns-f9fd979d6   2         2         2       26h
© 2025  mtitek