Docker on Windows the correct way
Windows WSL 2 Docker Tutorial
Author: Emad Zaamout
Sunday, Oct 24, 2022
Table of Contents
- Introduction
- What is Windows Subsystem for Linux (WSL2)?
- How to install WSL 2 on Windows?
- .wslconfig File
Introduction
Welcome back,
Today, were going to learn how to correctly run Docker on Windows 11.
To run Docker on windows, there’s few ways. You can either run it using the Docker legacy Hyper-V backend, or you can use WSL 2 which offers much better performance and stability.
What is Windows Subsystem for Linux (WSL2)?
The Windows System for Linux (WSL) lets you run a Linux environment directly on windows without needing to use virtual machines or dualboot setup.
This allows you to fully take advantage of Linux directly on your Windows machine. Its faster and it consumes less resources than running a virtual machine.
Its integrated, meaning that you can directly access all your files on your Windows machine.
It also provides a much faster experience when using Docker. Without WSL 2, just starting docker takes almost up to minute, while with WSL 2, it takes less than 10 seconds.
How to install WSL 2 on Windows?
Open Powershell as an administrator, and run the following command:
wsl --install
restart your computer. Ref: https://learn.microsoft.com/en-us/windows/wsl/install
How to install WSL 2 on Windows?
Before we dive further, its important that you create a wsl config file.
The wsl config file allows you configure all your linux distributions running in WSL 2. You can use it to do things like limit memory and processers.
Inside your User main folder on your Windows machine. Create a new file called ".wslconfig"
memory=4GB
processors=2
swap=8GB
restart your computer. Ref: https://learn.microsoft.com/en-us/windows/wsl/wsl-config
Other Posts
GET YOUR FREE ESTIMATE
CONTACT US TODAY FOR YOUR FREE CONSULTATION!
Contact us today to discuss your goals and we will create a simple roadmap to get you there. We look forward to speaking with you!
Main Office
Phone: 1 587-834-6567
Email: support@ahtcloud.com
32 Westwinds Crescent NE #130
Calgary, AB T3J 5L3, CA
Products
TMS
Cloud Based Transportation Management System
Hours Of Operation
Monday | 8:00 am - 5:00 pm |
---|---|
Tuesday | 8:00 am - 5:00 pm |
Wednesday | 8:00 am - 5:00 pm |
Thursday | 8:00 am - 5:00 pm |
Friday | 8:00 am - 5:00 pm |
Saturday | Closed |
Sunday | Closed |