Docker

Windows Setup

Installing Docker on Windows provides a robust environment for running Linux-based toolchains via Docker Desktop and the Windows Subsystem for Linux (WSL 2).


Prerequisites

Before installing Docker Desktop, ensure your Windows machine meets the following requirements:

  1. Windows 10 (64-bit) or Windows 11.
  2. Hardware Virtualization must be enabled in your BIOS/UEFI.
  3. WSL 2 (Windows Subsystem for Linux) should be installed and set as the default architecture.

Install WSL 2

If you haven't installed WSL 2 yet, open PowerShell as Administrator and run:

powershell
wsl --install

Restart your computer if prompted. By default, this installs the Ubuntu distribution.


Install Docker Desktop

  1. Download the Docker Desktop installer from the official Docker website.
  2. Run the installer (Docker Desktop Installer.exe).
  3. When prompted, ensure the option "Use WSL 2 instead of Hyper-V" is checked.
  4. Follow the installation wizard to complete the setup.
  5. After installation, click Close and restart if necessary.

Configure Docker Desktop

  1. Open Docker Desktop from the Start menu.
  2. Accept the terms and conditions if prompted.
  3. Click the gear icon (⚙️) in the top right to open Settings.
  4. Go to General and verify that "Use the WSL 2 based engine" is checked.
  5. Go to Resources > WSL Integration.
  6. Ensure "Enable integration with my default WSL distro" is checked. If you installed additional WSL distributions (like Ubuntu), you can enable integration for those specific distros here.
  7. Click Apply & restart.

Verify Installation

Open a new PowerShell window or your WSL terminal (e.g., Ubuntu) and run:

bash
docker --version

You should see output similar to Docker version 24.x.x, build xxxxxxx.

To test that Docker can pull and run containers, execute the classic hello-world image:

bash
docker run hello-world

If successful, you will see a message saying "Hello from Docker!".


Accessing USB Devices

One limitation of Docker Desktop on Windows/Mac is that passing physical USB devices (like your ESP32 or STM32 board) directly into the container can be tricky.

For Windows, the recommended approach is:

  1. Build the project inside the Docker container.
  2. Flash the generated .bin or .elf files from your host Windows machine using the native tools (like esptool.py or STM32CubeProgrammer).

Alternatively, you can use usbipd-win to bind USB devices to WSL 2, allowing the container to access them, but this is an advanced configuration.


Next Steps

Now that Docker is installed, learn how to manage multi-container applications using Docker Compose.

Previous
Why Docker?