![]() ![]() We wonât need it but if you decide to enable systemd with newer versions of WSL 2 then you can skip this entire step!Īll you have to do is drop this into your ~/.profile. Step 3: Ensure the Docker Service Runs in WSL 2Īt the time of this post systemd isnât started inside of WSL 2 by default. ![]() These steps came from official Linux installation guides: If youâre using a different distro itâs very similar. sudo update-alternatives -config iptables # Using Ubuntu 22.04 or Debian 10 / 11? You need to do 1 extra step for iptables # compatibility, you'll want to choose option (1) from the prompt to use iptables-legacy. # Sanity check that both tools were installed successfully # Add your user to the Docker group sudo usermod -aG docker $USER # Install Docker Compose v2 sudo apt-get update & sudo apt-get install docker-compose-plugin # Install Docker, you can ignore the warning from Docker about using WSL On my machine it added these 2 files in ~/.docker within my WSL 2 instance: If you previously had Docker Desktop installed you may also want to delete a few symlinks that Docker adds to WSL 2. docker-desktop--.Install the package with apt as follows: sudo apt-get update sudo apt-get install. Since weâre installing Docker directly inside of WSL 2 you wonât need Docker Desktop installed to make this work. Recommended approach to install Docker Desktop on Ubuntu: Set up Dockerâs package repository. Youâll also have options to run Kubernetes directly in WSL 2 if you choose to use KinD or any other tool that lets you run a Kubernetes cluster without Docker Desktop. Volumes are also lightning fast (comparable to native Linux). Youâll get the same conveniences of Docker Desktop such as being able to access localhost in your Windows browser of choice to access any web services you run in Docker since this feature is native to WSL 2. I say âshouldâ because I didnât personally try every single distro but thereâs nothing about this that would hint it wonât work on other distros. This post covers doing this on Ubuntu 20.04 and 22.04 but it should work with any distro that supports running Docker. ![]() Besides going over the steps below it covers the âwhyâ and the pros / cons of doing this. Prefer video? Hereâs a recorded version of this tip on YouTube. You won't need to run systemd inside of WSL 2 either. Updated on November 22nd, 2022 in #dev-environment, #docker Install Docker in WSL 2 without Docker Desktop It's really fast and only requires a few lines of shell scripting. ![]()
0 Comments
Leave a Reply. |