Skip to content

Commit cb2ec53

Browse files
authored
docs: Docker Engine on Windows how-to article (#4406)
1 parent 0c07d96 commit cb2ec53

File tree

4 files changed

+152
-0
lines changed

4 files changed

+152
-0
lines changed
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
---
2+
navTitle: Docker Engine on Windows
3+
meta:
4+
description: Install Docker Engine (Docker CE) on Windows.
5+
tags:
6+
- docker for windows
7+
- install docker on windows
8+
- install docker on windows with wsl2
9+
- running docker on windows 11
10+
---
11+
12+
# How to Install Docker Engine (Docker CE) on Windows using WSL2
13+
14+
We recommend running FlowFuse Docker on Linux when ever possible as containers are inherently a Linux technology. If that really is not possible in your environment and the base OS must be Windows then the next best option is to use the WSL2 (Windows Subsystem for Linux v2) feature of Windows.
15+
16+
## Prerequisites
17+
18+
Ensure your system meets the following Windows Subsystem for Linux v2 requirements:
19+
20+
- Windows Server 2022
21+
- Windows 10 version 2004 and higher (Build 19041 and higher)
22+
- Windows 11
23+
24+
## Step 1: Install Windows Subsystem for Linux
25+
26+
Open PowerShell as an administrator and run the following commands:
27+
28+
1. Install WSL and the default Linux distribution (Ubuntu) using the following command:
29+
```powershell
30+
wsl --install
31+
```
32+
33+
2. Reboot your system to apply changes
34+
```powershell
35+
shutdown -r -t 5
36+
```
37+
38+
After the reboot, WSL will automatically start installing the Ubuntu Linux distribution.
39+
You will be prompted to create a new UNIX account. Follow the instructions to create a new user account and set a password.
40+
![wsl-unix-user-creation](../images/wsl-unix-user.png)
41+
42+
Once completed, you will be dropped into a new Ubuntu shell.
43+
![wsl-install-complete](../images/wsl-install-complete.png)
44+
45+
3. Confirm using proper WSL version, by running (in Powershell window):
46+
```powershell
47+
wsl --status
48+
```
49+
50+
## Step 2: Install Docker on Ubuntu
51+
52+
Once the Ubuntu system is ready, follow these steps to install Docker:
53+
54+
1. **Remove Conflicting Packages**
55+
56+
First, remove any existing Docker packages that might conflict with the installation:
57+
58+
```bash
59+
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
60+
```
61+
62+
2. **Add Docker’s Official GPG Key and APT Repository**
63+
64+
Next, update your package list and add Docker's official GPG key and APT repository:
65+
66+
```bash
67+
sudo apt-get update
68+
sudo apt-get install ca-certificates curl
69+
sudo install -m 0755 -d /etc/apt/keyrings
70+
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
71+
sudo chmod a+r /etc/apt/keyrings/docker.asc
72+
```
73+
74+
Add the Docker repository to your APT sources:
75+
76+
```bash
77+
echo \
78+
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
79+
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
80+
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
81+
sudo apt-get update
82+
```
83+
84+
3. **Install Docker Packages**
85+
86+
Now, install Docker and its associated packages:
87+
88+
```bash
89+
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
90+
```
91+
92+
4. **Start the Docker Service**
93+
94+
Start Docker using the following command:
95+
96+
```bash
97+
sudo /etc/init.d/docker start
98+
```
99+
100+
5. **Verify Docker Installation**
101+
102+
Run a test Docker container to verify that Docker is installed and running correctly:
103+
104+
```bash
105+
sudo docker run hello-world
106+
```
107+
108+
If Docker is installed correctly, you should see a similar output:
109+
110+
![wsl-docker-installation-complete](../images/wsl-docker-complete.png)
111+
112+
113+
Once Docker is installed, you can [install the FlowFuse platform using docker compose](./README.md).
114+
115+
116+
## Optional: Port Forwarding from External IP Address to Docker Container
117+
118+
If you want to forward a port from your external IP address to a Docker container, follow these additional steps.
119+
120+
Consider a scenario where you want to run an Nginx container:
121+
122+
1. **Run the Nginx Container**
123+
124+
In the Linux shell, start the Nginx container, binding port 8080 on your localhost to port 80 in the container:
125+
126+
```bash
127+
sudo docker run -d -p 8080:80 --name mynginx nginx
128+
```
129+
130+
2. **Set Up Port Forwarding**
131+
132+
To forward traffic from an external IP to your container, run the following PowerShell command (administrator privileges required):
133+
134+
```powershell
135+
netsh interface portproxy add v4tov4 listenport=8080 listenaddress=0.0.0.0 connectport=8080 connectaddress=127.0.0.1
136+
```
137+
138+
This command forwards traffic from port 8080 on your external IP address to port 8080 on your localhost, where the Nginx container is listening for connections.
139+
The value for `listenport` can be changed as needed.
140+
141+
3. **Open the Port on Your Firewall**
142+
143+
Ensure that port 8080 (or any other port you specivied as a value for `listenport` in the previous step) is open on your firewall:
144+
145+
```powershell
146+
New-NetFireWallRule -DisplayName 'WSL 8080TCP' -Direction Inbound -LocalPort 8080 -Action Allow -Protocol TCP
147+
New-NetFireWallRule -DisplayName 'WSL 8080TCP' -Direction Outbound -LocalPort 8080 -Action Allow -Protocol TCP
148+
```
149+
150+
4. **Access the Nginx Container**
151+
152+
You can now access the Nginx container by visiting `http://<server-external-ip>:8080` in your browser.
335 KB
Loading
222 KB
Loading
92.7 KB
Loading

0 commit comments

Comments
 (0)