If you do not yet have a running WSL instance with a distro of your choice, the next step is to pick one from the Microsoft Store. Hopefully you will see something like "Version 21H2. To tell what version you are running, run winver in Powershell or CMD, or just type Win key and R (⊞-r) to open the Run dialog and then enter winver. To run WSL 2, Windows version 1903 or higher is needed, with Build 18362 or higher. Microsoft's has step-by-step instructions on how to upgrade to WSL 2. You will most certainly need WSL 2 to run the Docker service.ĭoes the command wsl -set-default-version 2 work? This will set the default version to WSL 2, or fail if you are still on the first version. ![]() Microsoft offers a more detailed comparison in the docs. WSL 1 was genius with running Linux on the Windows kernel, but of course lacked some of the features, such as containers. WSL 2 uses an actual Linux kernel that allows Linux containers. Please note that these steps require WSL 2 (not version 1). Maybe some tooling you use can't handle Podman, or you just want to put WSL through its paces. Sometimes, one just needs Docker to work. And, yes, VSCode can work with podman.Īnd yet. I have written about getting Podman to work on WSL 2. Without needing to worry about sockets and ports, a lot of headaches go away. See more details about the Docker subscription model here.īefore we mosey along, though: are you aware of Podman? Podman is daemonless (no background service needed), modern (cgroups v2 out of the box), supports rootless, and serves as a drop-in replacement for Docker. Of course, if you use Docker without Docker Desktop, as detailed in this article, then this does not apply. If you are using it for work, and your company exceeds a certain size or revenue, then consider paying for a subscription. Note that Docker Desktop is only free individuals or for small companies. then perhaps you want to run the docker daemon ( dockerd) in the WSL distro of your choice and be happy. If you came here looking how to get Docker running easily, or if you want Windows containers (still a rarity) out of the box, then Docker Desktop is your friend, and you can go install it now.īut if you, like me, feel that all the added complexity of Docker Desktop is unnecessary, you don't need Windows containers, or you are simply tired of that whale in the system tray taking. Reading about what goes on under the hood is an entertaining and informative endeavor, as well. With Docker Desktop's WSL 2 backend, Docker integrates with Windows in a fairly elegant way, and the docker client can be launched from either Powershell or Linux. If you want Docker to work on Windows and WSL 2, installing Docker Desktop is most likely the way to go. See details regarding the companion Github repo by scrolling to the bottom.Īre you sure you don't want Docker Desktop?īefore proceeding, let's note that Docker Desktop is amazing. Plenty more nuance and decisions below, of course. For simplicity, rather than launch a Windows-based Docker client, launch docker inside WSL.If sharing and privileged access without sudo are desired, configure the docker group to have the same group ID across all WSL instances.If sharing the Docker daemon between WSL instances is desired, configure it to use a socket stored in the shared /mnt/wsl directory.Instead of using an init system such as systemd to launch the Docker daemon, launch it by calling dockerd manually.This article attempts to explore such a process and options along the way.Ĭontrary to what the length of this article might suggest, getting Docker working on WSL is fairly simple. However, due to both WSL and Docker complexities, a little tender loving care is required to get Docker up and running. Docker works on WSL 2, and without requiring the robust but heavy Docker Desktop if that is undesirable. ![]() Windows Subsystem for Linux 2 sports an actual Linux kernel, supporting real Linux containers and Docker. And further emphasis on the optional nature of the /mnt/wsl/shared-docker socket directory. A little more suggestion about TCP access, as well. Updated April 10, 2022, with current Alpine instructions, Debian/Ubuntu package signing tweaks (no more apt-key), and better guidance for handling iptables in Debian.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |