serving the solutions day and night

Pages

Wednesday, June 25, 2025

Install Docker CLI on Windows

 

Step-by-Step: Install Docker CLI on Windows

1. Download the Docker CLI Binary

2. Extract the Archive

  • Extract the contents of the .zip file to a directory of your choice, such as: C:\Tools\DockerCLI

  • Inside this directory, you should find the docker.exe file.

3. Add Docker CLI to System PATH

  • Open PowerShell as Administrator and run the following command to add the directory to your system's PATH:

    [System.Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Tools\DockerCLI", [System.EnvironmentVariableTarget]::Machine)

    Replace C:\Tools\DockerCLI with the path where you extracted docker.exe.

  • Restart your terminal to apply the changes.

4. Verify the Installation

  • Open a new PowerShell or Command Prompt and run: docker version

    You should see output similar to:

    Client: Docker CLI
-------------------------------------------------------------
Can azd use Podman instead of Docker?

Use Podman with Docker socket on Windows

Podman for Windows uses WSL2 under the hood. You need to expose a Docker-compatible socket inside WSL2, then make it accessible to Windows apps like azd.


Step-by-Step: Enable Podman's Docker Socket on Windows

A. Ensure Podman is installed

Install Podman for Windows (with WSL) — it should include the Podman machine.

You can verify it with:

podman machine init
podman machine start

This sets up and runs a WSL2 virtual machine with Podman inside.

B. Enable Docker Socket inside the VM

Run the following in Command Prompt or PowerShell:

podman machine ssh

Then, inside the WSL session, run:

systemctl --user enable --now podman.socket

Or if systemctl is not available:

podman system service --time=0 tcp:127.0.0.1:2375 &

This command starts the Docker-compatible API on localhost:2375 inside WSL.

Run these commands inside Podman machine (WSL):

mkdir -p ~/.config/containers
echo "tcp:127.0.0.1:2375" > ~/.config/containers/podman-service.socket 

This creates the necessary directory and writes the socket configuration file. 

🌉 C. Expose Docker Socket to Windows

Still inside Podman machine, do:

echo "tcp:127.0.0.1:2375" > ~/.config/containers/podman-service.socket

Now exit the WSL/Podman shell and go back to Windows terminal.


D. Set Environment Variable on Windows

Set DOCKER_HOST so azd and other tools know to use Podman:

set DOCKER_HOST=tcp://localhost:2375

Or for PowerShell:

$env:DOCKER_HOST="tcp://localhost:2375"

You can also make this permanent by adding it to your system environment variables.

E. Verify it works

Try running: docker version

No comments: