←  back to blog
How to setup a development environment for Docker on Windows

How to setup a development environment for Docker on Windows

The Windows operating system is best for windows-specific projects only. Running technology like Docker containers on a Windows operating system can be a huge pain. When scaled up to the organizational level, with many devices on different operating systems and endpoint security scanning tools, this becomes a serious challenge.

On Linux, containers are native and run directly on the operating system. On Windows, running a Docker container requires you to spin up a Linux virtual machine (VM). This VM method uses up a lot of resources and creates slowness and lag. Tools like Vagrant similarly suffer from these challenges due to the same file system incompatibilities.

How to set up a Windows development environment for Docker? Use Windows Subsystem for Linux (WSL) or Hyper V, setting up another device (i.e. Raspberry Pi), dual boot your device, or use a cloud development environment (CDE) such as Gitpod.

Options for Windows and container developer environments

  1. Docker Desktop and WSL2 (or Hyper V)
  2. Dual boot your device
  3. Setup another device (i.e. Raspberry Pi or Mini PC)
  4. Use a cloud development environment (CDE)

Docker Desktop and WSL2 (or Hyper V)

Windows Subsystem for Linux (WSL 2) is a compatibility layer for running Linux in a virtualized environment on Windows. Using WSL 2 and Docker Desktop, you can run Docker on Windows. You’ll need at least a 64-bit processor and at least 4GB of RAM (though more is preferable for handling multiple containers or resource-intensive applications).

That said, even though Docker can be run on Windows, there are some challenges. If your Docker setup on WSL crashes, it can delete your volumes, meaning that you might lose work, and recovering from this can be challenging. Also, while WSL 2 offers improved performance over WSL 1, I/O can also still be slower than when using a native Linux installation.

For more information, see the Docker Desktop Windows setup instructions. There are some known issues that you might need to face while using Docker Desktop with WSL.

Dual boot your device

To avoid the virtualizsation performance challenges with WSL2 and Docker Desktop you can take the route of dual-booting your device. Dual booting is the process of installing two or more operating systems on a single device and being able to choose which one to boot into during startup. Dual booting has the advantage of not requiring any additional new hardware, and means you can work natively in Linux, mitigating the performance issues of virtualization.

However, it makes it harder to swap between the operating systems, and you’ll also need to partition your hard drive and familiarize yourself with working on Linux directly.

Manage two devices (i.e. Raspberry Pi or Mini PC)

Similarly to dual booting, some developers choose to have two physical devices, where one device is running Linux as the core operating system. Again, this mitigates the performance issues of virtualization on windows, but it does require an entirely separate device.

Use a cloud development environment (CDE)

The final option is to develop remotely, using a tool such as a cloud development environment (CDE). A CDE is a good option when you’re having challenges with getting a stable and consistent development environment on Windows.

Gitpod’s workspaces are development environments based on Linux that allow you to install all the tools required for development. Since the environment is also running remotely in the cloud, you as a developer are not constrained by compatibility with your client operating system (Windows).

The interface into the remote running workspace is an editor such as VS Code on your Desktop, or in a browser, or even a JetBrains IDE such as IntelliJ. A CDE like Gitpod can even forward your ports automatically, so when you start your application, localhost mappings work. Cloud development environments feel just like writing code on your local machine does.

You can use up to 8 cores and 16GB RAM on pay-as-you-go, or up to 30 cores and 54GB of RAM on the Gitpod Enterprise tier. Gitpod free plan includes 50 hours free a month.

Author
@loujaybee's avatar on GitHub Lou Bichard Product Manager at Gitpod

Last updated

May 15, 2024

Helpful resource How to replace VDI white paper
Standardize and automate your development environments today