Skip to content

Commit ca07da3

Browse files
committed
add Docker in WSL without Docker Desktop
1 parent 60c5496 commit ca07da3

1 file changed

Lines changed: 103 additions & 0 deletions

File tree

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
+++
2+
date = '2026-02-07T08:53:47-06:00'
3+
title = 'Docker in WSL Without Docker Desktop'
4+
slug = 'Docker-in-WSL-without-Docker-Desktop'
5+
tags = ['Docker', 'WSL', 'Windows', 'Linux', 'PowerShell']
6+
categories = ['Development', 'Projects']
7+
author = 'Paul Welter'
8+
description = 'A lightweight alternative to Docker Desktop: Install and run Docker natively in WSL using an automated PowerShell script'
9+
+++
10+
11+
## The Challenge with Docker Desktop
12+
13+
Docker Desktop has been the solution for running Docker on Windows, but it comes with some considerations:
14+
15+
- Licensing requirements for commercial use
16+
- Resource overhead from running a full Docker Desktop
17+
- Complexity for users who just need basic Docker functionality
18+
19+
For developers looking for a lightweight alternative, running Docker directly in Windows Subsystem for Linux 2 (WSL) is a practical option.
20+
21+
## Introducing docker-wsl
22+
23+
I've created [docker-wsl](https://github.com/loresoft/docker-wsl), an automated PowerShell script that installs and configures Docker within WSL without requiring Docker Desktop. This project enables you to run Docker natively in WSL's Ubuntu environment while maintaining full compatibility with Windows PowerShell.
24+
25+
## Key Features
26+
27+
The automated installation script provides:
28+
29+
- **WSL Configuration**: Sets up WSL with mirrored networking mode for seamless connectivity
30+
- **Ubuntu Distribution**: Installs a fresh Ubuntu instance within WSL
31+
- **Docker Engine**: Deploys Docker natively within the Ubuntu environment
32+
- **Systemd Integration**: Configures Docker as a systemd service for reliable daemon management
33+
- **Windows Docker CLI**: Installs the Docker CLI tools for Windows
34+
- **Automatic Configuration**: Detects WSL IP and configures DOCKER_HOST environment variable
35+
- **Auto-Startup**: Creates a Windows Task Scheduler job to start Docker at user logon
36+
- **Cross-Platform Access**: Run Docker commands from both Windows PowerShell and WSL
37+
38+
## How It Works
39+
40+
The architecture is straightforward:
41+
42+
1. The Docker daemon runs as a systemd service within the WSL Ubuntu instance
43+
2. WSL's mirrored networking mode exposes the daemon on localhost (127.0.0.1:2375)
44+
3. Windows PowerShell communicates with the daemon through this local connection
45+
4. A scheduled task keeps the Ubuntu distribution active, ensuring Docker remains accessible
46+
47+
This approach eliminates the need for Docker Desktop's overhead while maintaining full Docker functionality.
48+
49+
## Installation
50+
51+
Getting started is straightforward:
52+
53+
1. **Run as Administrator**: Execute the PowerShell script with administrator privileges
54+
2. **Ubuntu Setup**: Complete the Ubuntu user setup when prompted
55+
3. **Restart**: Reboot your computer to complete WSL configuration
56+
4. **Start Using Docker**: Docker commands work from both Windows and WSL terminals
57+
58+
The script handles all eight installation steps automatically:
59+
60+
- WSL feature enablement
61+
- Ubuntu distribution installation
62+
- Docker Engine deployment
63+
- Networking configuration
64+
- CLI tool installation
65+
- Environment variable setup
66+
- Task Scheduler configuration
67+
68+
## Usage
69+
70+
Once installed, Docker works seamlessly across environments:
71+
72+
```powershell
73+
# From Windows PowerShell
74+
docker ps
75+
docker run hello-world
76+
docker compose up
77+
```
78+
79+
```bash
80+
# From WSL Ubuntu
81+
docker ps
82+
docker run hello-world
83+
docker compose up
84+
```
85+
86+
## Security Considerations
87+
88+
**Important**: This configuration exposes Docker on port 2375 without TLS encryption. This is suitable for local development environments but **should not be used in production systems**. The setup is designed for single-user development machines where the security trade-off enables simplicity and performance.
89+
90+
## Benefits
91+
92+
Compared to Docker Desktop, this approach offers:
93+
94+
- **Lightweight**: No Docker Desktop overhead
95+
- **Native Performance**: Docker runs directly in Linux
96+
- **Free**: No licensing considerations for commercial use
97+
- **Flexible**: Full control over Docker configuration
98+
- **Integrated**: Works seamlessly with Windows and WSL workflows
99+
- **IDE Support**: Compatible with Visual Studio and VS Code Docker extensions
100+
101+
## Get Started
102+
103+
Visit the [docker-wsl GitHub repository](https://github.com/loresoft/docker-wsl) to download the installation script and view detailed documentation. The entire setup takes just a few minutes and provides a lightweight Docker development environment on Windows.

0 commit comments

Comments
 (0)