<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Nicolas Louis</title>
    <description>The latest articles on Forem by Nicolas Louis (@_nicolas_louis_).</description>
    <link>https://forem.com/_nicolas_louis_</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F713706%2F0a6df771-8308-4627-bd4e-09b94ed8a717.gif</url>
      <title>Forem: Nicolas Louis</title>
      <link>https://forem.com/_nicolas_louis_</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/_nicolas_louis_"/>
    <language>en</language>
    <item>
      <title>How to run docker on Windows without Docker Desktop</title>
      <dc:creator>Nicolas Louis</dc:creator>
      <pubDate>Sun, 26 Sep 2021 19:25:09 +0000</pubDate>
      <link>https://forem.com/_nicolas_louis_/how-to-run-docker-on-windows-without-docker-desktop-hik</link>
      <guid>https://forem.com/_nicolas_louis_/how-to-run-docker-on-windows-without-docker-desktop-hik</guid>
      <description>&lt;p&gt;Since  Docker announced a new subscription for Docker Desktop for personal use, educational institutions, non-commercial open-source projects and small businesses, other enterprises need to acquire licences for all installations of Docker Desktop.&lt;/p&gt;

&lt;p&gt;So is there an alternative on Windows to continue to legally use containers with a docker command and a nice UI like VSCode without paying a licence : the answer is YES !&lt;/p&gt;

&lt;p&gt;We are doing magic with Windows 10, Ubuntu on WSL2, &lt;em&gt;docker builder cli&lt;/em&gt; for windows and a little elbow grease.&lt;/p&gt;

&lt;p&gt;Big Thanks to Jonathan Bowman for &lt;a href="https://dev.to/bowmanjd/install-docker-on-windows-wsl-without-docker-desktop-34m9"&gt;his article&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I reused and I adapted it to make &lt;em&gt;VisualCode&lt;/em&gt; working with &lt;strong&gt;dockerd&lt;/strong&gt; under WSL2.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation on Windows
&lt;/h2&gt;

&lt;p&gt;On your windows, you need to install a couple of things :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;WSL2 : &lt;a href="https://docs.microsoft.com/en-us/windows/wsl/install#step-2-update-to-wsl-2" rel="noopener noreferrer"&gt;Install WSL | Microsoft Docs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Ubuntu on WSL2 : in Microsoft Store Ubuntu 20.04 LTS&lt;/li&gt;
&lt;li&gt;Visual Code : it can be downloaded at &lt;a href="https://code.visualstudio.com/" rel="noopener noreferrer"&gt;Visual Studio Code - Code Editing. Redefined&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Docker extension for VSCode : directly from Visual Code Extensions Marketplace
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp4l24p641gi3paubq2c2.png" alt="VSCode Docker extension"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Installation of dockerd in WSL2/Ubuntu
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;(Inspired from the Jonathan Bowman's article)&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Is your user a "sudoer" ?
&lt;/h3&gt;

&lt;p&gt;Check if &lt;strong&gt;sudo&lt;/strong&gt; is installed if not : &lt;code&gt;*apt install sudo*&lt;/code&gt;`&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;grep -E 'sudo|wheel' /etc/group&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You would see something like  &lt;em&gt;sudo: x:27:myusername&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Otherwise, We use &lt;strong&gt;usermod&lt;/strong&gt; to add an user to the &lt;em&gt;sudoer&lt;/em&gt; group&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;usermod -aG sudo myusername&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Finally you can check with this command : &lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;sudo grep -E '%sudo|%wheel' /etc/sudoers&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You'll have something like&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;%wheel ALL=(ALL) ALL&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you see a # at the first position, the line is commented, run &lt;strong&gt;sudo visudo&lt;/strong&gt;, find the corresponding line and remove the #, save and check again.&lt;/p&gt;

&lt;h3&gt;
  
  
  Update your Ubuntu distro
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;sudo apt update &amp;amp;&amp;amp; sudo apt upgrade&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Remove Residue from previous docker installations
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;sudo apt remove docker docker-engine docker.io containerd runc&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Debian/Ubuntu package repository configuration
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;source /etc/os-release&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Trust the repo :&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;curl -fsSL &lt;a href="https://download.docker.com/linux/$%7BID%7D/gpg" rel="noopener noreferrer"&gt;https://download.docker.com/linux/${ID}/gpg&lt;/a&gt; | sudo apt-key add -&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Update repo info :&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;echo "deb [arch=amd64] &lt;a href="https://download.docker.com/linux/$%7BID%7D" rel="noopener noreferrer"&gt;https://download.docker.com/linux/${ID}&lt;/a&gt; ${VERSION_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/docker.list&lt;br&gt;
sudo apt update&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Install official Docker release
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;sudo apt install docker-ce docker-ce-cli containerd.io&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Add user to docker group
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;sudo usermod -aG docker $USER&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;"Then close that WSL window, and launch WSL again. You should see docker when you run the command groups to list group memberships."&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Get IP address in WSL2
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;echo `ifconfig eth0 | grep -E "([0-9]{1,3}.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d:&lt;code&gt;&lt;/code&gt;`&lt;/p&gt;

&lt;p&gt;You should have something like  &lt;strong&gt;172.20.5.64&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Launch dockerd
&lt;/h2&gt;

&lt;p&gt;In WSL, there is no &lt;em&gt;systemd&lt;/em&gt; or other init system. So we need to launch manually docker with the automatic collect of the IP address&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;sudo dockerd -H  `ifconfig eth0 | grep -E "([0-9]{1,3}.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d:&lt;code&gt;&lt;/code&gt;`&lt;/p&gt;

&lt;p&gt;There should be several lines of info, warnings related to tls, and the like, with something like API listen on &lt;strong&gt;172.20.5.64:2375&lt;/strong&gt; at the end. If so, you have success.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test docker command
&lt;/h2&gt;

&lt;p&gt;Get the IP address given with the line API listen and In another WSL terminal, you can test the following command :&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;docker -H 172.20.5.64 run --rm hello-world&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You'll get something like this :&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hello from Docker! &lt;/p&gt;

&lt;p&gt;...&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Installing &lt;strong&gt;Docker.exe&lt;/strong&gt; on Windows
&lt;/h2&gt;

&lt;p&gt;Stefan Scherer is maintaining the project docker-cli-builder on &lt;a href="https://github.com/StefanScherer/docker-cli-builder/releases" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; where we can download the &lt;strong&gt;docker.exe&lt;/strong&gt; command in standalone :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Download the exe&lt;/li&gt;
&lt;li&gt;Put it in the directory like &lt;strong&gt;c:\bin&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Add this directory in the path for executables : &lt;em&gt;System Properties\Environement Variables\System Variables\Path&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsfwpqdkh8xhy2xhy6hwc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsfwpqdkh8xhy2xhy6hwc.png" alt="Add path to docker binary"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Check if &lt;strong&gt;docker&lt;/strong&gt; is working
&lt;/h3&gt;

&lt;p&gt;Once done, logout from your session and log again&lt;br&gt;
In a windows terminal (Windows Power Shell) , launch :&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;docker --version&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You would get something like :&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Docker version 20.10.5, build 55c4c8896&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Launch dockerd
&lt;/h3&gt;

&lt;p&gt;Open a terminal in Wsl2, you execute &lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;sudo dockerd -H  `ifconfig eth0 | grep -E "([0-9]{1,3}.){3}[0-9]{1,3}" | grep -v 127.0.0.1 |awk '{ print $2 }' | cut -f2 -d:&lt;code&gt;&lt;/code&gt;`&lt;/p&gt;

&lt;p&gt;And you get the IP address, as described before&lt;/p&gt;

&lt;h3&gt;
  
  
  Test docker on Windows
&lt;/h3&gt;

&lt;p&gt;In the Powershell windows of the terminal, you can run the following command&lt;br&gt;
&lt;code&gt;&lt;/code&gt;c:\bin\docker -H tcp://172.20.5.64 run --rm hello-world&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And you would get :&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hello from Docker!&lt;/p&gt;

&lt;p&gt;...        &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Great we have now docker in windows running with WSL2.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;But let's continue magic !&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Configure VSCode to access to WSL2 docker
&lt;/h2&gt;

&lt;p&gt;If you launch Visual Code and you select the docker extension, you'll get error in the panel asking if docker is installed... Yes of course it's installed but not configured to access to WSL2&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4onnmug3igs95alhd9hh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4onnmug3igs95alhd9hh.png" alt="VSCode with docker extension errors"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To do so, click on the icon (?) on the top right of the section "Containers" and select "Edit settings..."&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw88fkywtbd5sm4sf1ota.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw88fkywtbd5sm4sf1ota.png" alt="VSCode edit docker settings"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You'll get around 56 settings and you search for  &lt;em&gt;"Docker:Host"&lt;/em&gt;  where you put the line &lt;strong&gt;"tcp://172.20.5.64:2375"&lt;/strong&gt;  where you can replace the highlighted ip address by the one you got before&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh6b02nk14i4xaielwoxr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh6b02nk14i4xaielwoxr.png" alt="VSCode set Docker:Host"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once done, you come back to the panel and you click on &lt;em&gt;"refresh"&lt;/em&gt; icon (top right of each sections) and you would get information from your &lt;strong&gt;dockerd&lt;/strong&gt; running in WSL2&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fehfyeoma7e96xao94nqn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fehfyeoma7e96xao94nqn.png" alt="VSCode it works"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Making everything works without knowing IP
&lt;/h2&gt;

&lt;p&gt;Now, how to run &lt;strong&gt;dockerd&lt;/strong&gt; and &lt;em&gt;docker&lt;/em&gt; without copy&amp;amp;paste IP address in command line nor VSCode. &lt;/p&gt;

&lt;p&gt;In WSL2, it's not possible to assign IP address but, I can use the windows port forwarding to redirect a local port from the host to a specific one of my distribution. Hence I could put &lt;strong&gt;"tcp://localhost:2375"&lt;/strong&gt; in VsCode and the calls will be redirected to dockerd running in WSL2-Ubuntu.&lt;/p&gt;

&lt;p&gt;For this, I run the powershell script lines in windows  terminal &lt;em&gt;running as administrator&lt;/em&gt; :&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;$ip = (wsl sh -c "hostname -I").Split(" ")[0]&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;netsh interface portproxy add v4tov4 listenport=2375 connectport=2375 connectaddress=$ip&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;wsl sh -c "sudo dockerd -H tcp://$ip"&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Script explanation :    &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First, I collect the IP address of my default distro with the wsl command.&lt;/li&gt;
&lt;li&gt;Second, I set the port forwarding &lt;em&gt;2375&lt;/em&gt; to my distro&lt;/li&gt;
&lt;li&gt;Third, I launch in my distro dockerd with the IP&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When executing these lines you'll be prompted to enter your distro password (&lt;em&gt;sudo&lt;/em&gt;) and I'll see after the log of dockerd. Everything will work fine when I'll see the message &lt;em&gt;"API listen on 172.18.75.23:2375"&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;In parallel, in a windows terminal opened in my distro, I can check with &lt;strong&gt;top&lt;/strong&gt; or &lt;strong&gt;htop&lt;/strong&gt; if &lt;em&gt;dockerd&lt;/em&gt; processes are running.&lt;/p&gt;

&lt;p&gt;In &lt;em&gt;VSCode&lt;/em&gt;, I update my &lt;em&gt;Docker:Host&lt;/em&gt; setting with &lt;em&gt;tcp://localhost:2375&lt;/em&gt; :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcv8ty56xvrw5vjw9tqsm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcv8ty56xvrw5vjw9tqsm.png" alt="VSCode Docker host to localhost"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And the magic is there :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F100j4d491bo3f9uq82iq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F100j4d491bo3f9uq82iq.png" alt="VSCode Docker extension working with localhost"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now I can know create a dedicated powershell script with the previous line : &lt;strong&gt;start_docker.ps1&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In a windows terminal running with administrator privileges, I set the &lt;em&gt;Execution policy&lt;/em&gt; with  :&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;Set-ExecutionPolicy RemoteSigned&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And every time I want to run &lt;strong&gt;dockerd&lt;/strong&gt;, I launch the &lt;strong&gt;start_docker.ps1&lt;/strong&gt; script:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7ft5cjuok5l546a715uz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7ft5cjuok5l546a715uz.png" alt="Launch docked from Windows"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And if you see &lt;em&gt;API Listen on 172.18.75.23:2375&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;Everything works !&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1f0xyu8rxvhu13bwai0z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1f0xyu8rxvhu13bwai0z.png" alt="Logs 1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, I want to use &lt;strong&gt;docker&lt;/strong&gt; without &lt;em&gt;-H&lt;/em&gt; parameter, for this, I add a new system environment variable called &lt;em&gt;DOCKER_HOST&lt;/em&gt; set to &lt;strong&gt;tcp://localhost:2375&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff1dwdxjebmy8j4d108rg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff1dwdxjebmy8j4d108rg.png" alt="Add DOCKER_HOST as system variable"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, in a windows terminal, I can simply run a command like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;docker image ls&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foplxg2wm78f4lg5gevrz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foplxg2wm78f4lg5gevrz.png" alt="Simple use of docker command"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  In conclusion
&lt;/h2&gt;

&lt;p&gt;This article shows how we can use docker in windows and WSL2 without Docker Workstation&lt;br&gt;
To do so, we just need first to run a powershell script launching &lt;strong&gt;dockerd&lt;/strong&gt; in WSL2 and once &lt;strong&gt;dockerd&lt;/strong&gt; is listening we can simply use the command &lt;strong&gt;docker&lt;/strong&gt; (maintained by Stefan Scherer).&lt;/p&gt;

&lt;p&gt;Yes ! We can continue to develop with containers without Docker Workstation.&lt;/p&gt;

&lt;p&gt;Enjoy !&lt;/p&gt;

</description>
      <category>docker</category>
      <category>windows</category>
      <category>wsl2</category>
    </item>
  </channel>
</rss>
