Skip to content

Instantly share code, notes, and snippets.

@bonartm
Last active March 21, 2022 15:59
Show Gist options
  • Save bonartm/2b754a61218daa9da64e94da620d8f18 to your computer and use it in GitHub Desktop.
Save bonartm/2b754a61218daa9da64e94da620d8f18 to your computer and use it in GitHub Desktop.
Docker Installation for Windows

Docker Installation - Checklist for Windows

Which Windows Version Do I Have?

  1. Press the Win+R Key
  2. Type in winver and press Enter

Step 1. Enable Hardware Virtualization in BIOS

  • Reboot your computer and press the F10, F2, F12, F1, or DEL key (depends on the manufacturer) to enter the BIOS.
  • Look for and enable the virtualization option in the BIOS settings (something like Virtualization Technology (VTx))
  • Save and reboot

Step 2. Update your System

  • Windows 10 64-bit: Pro, Enterprise, or Education: You need at least Build 16299 or later.

  • Windows 10 64-bit Home: You need at least Version 1903 or higher with Build 18362 or later.

    Use the Windows Update Assistant to update your system to the latest version

Step 3. Enable WSL, Hyper-V and Containers Windows features

  1. Left click on the Windows button, search for Turn Windows Features on or off:

    • Windows 10 64-bit: Pro, Enterprise, or Education: Enable Hyper-V, Windows Subsystem for Linux , Virtual Machine Platform, Windows Hypervisor Platform
    • Windows 10 64-bit Home: Enable Windows Subsystem for Linux, Virtual Machine Platform and Windows Hypervisor Platform

Apply the updates and restart your machine!

Step 4. Download and install the Linux kernel update package

https://docs.microsoft.com/en-us/windows/wsl/wsl2-kernel

Step 5. Set WSL2 as default version

Open the PowerShell as Administrator and run the command:

wsl --set-default-version 2

Option A: Install a new WSL distribution from the Appstore

Go to the Microsoft Store and install Ubuntu 20-04 LTS. Also have a look here: here: https://docs.microsoft.com/en-us/windows/wsl/install-win10#step-6---install-your-linux-distribution-of-choice

Once the installation finshed you need to type in a new username and password for Ubuntu/WSL.

Option B: Update existing WSL distribution

If your are already running WSL 1 then you should update from WSL 1 to WSL 2. Find out the name of your distribution (type that into the powershell):

wsl --list --verbose

To change the WSL version to 2, type in:

wsl --set-version <distribution name> 2

Updating an existing WSL distribution from WSL1 to WSL2 can take several minutes (up to 30 minutes!).

Step 6. Install Docker

Download the installer from here: https://hub.docker.com/editions/community/docker-ce-desktop-windows/

Follow the instructions here: https://docs.docker.com/docker-for-windows/install/#install-docker-desktop-on-windows

When prompted, ensure the Enable WSL 2 Features option is selected on the Configuration page.

If your admin account is different to your user account, you must add the user to the docker-users group. Run Computer Management as an administrator and navigate to Local Users and Groups > Groups > docker-users. Right-click to add the user to the group. Log out and log back in for the changes to take effect.

Step 7. Use WSL 2 as default backend

Also see here: https://docs.docker.com/docker-for-windows/wsl/

Open Docker Desktop and activate WSL 2:

Also make sure to activate WSL 2 for all your additional distributions (click on every switch:

**Apply and restart **!

Step 8. Test your installation

Restart your computer, open WSL and type in:

docker run hello-world

If you see this message:

Hello from Docker!
This message shows that your installation appears to be working correctly.

Then your installation worked!

Step 9: Install python inside the WSL

To install python inside the WSL (type that in the ubuntu shell)

  • Download the installer: wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
  • Execute it: bash Miniconda3-latest-Linux-x86_64.sh
  • Press ENTER and yes whenever you get asked for it
  • After the installation, type in ~/miniconda3/bin/conda init bash to activate conda and python
  • Restart the terminal

Good to know

  • to drag and drop files from windows to WSL you can open the file navigator by typing into the Ubuntu command line/WSL: explorer.exe .
  • you can also open VSCode inside WSL by typing into the Ubuntu command line/WSL: code .

Optional: Check your version of WSL

Open the PowerShel and type in the command:

wsl --list --verbose

To change the WSL version of a specific distribution, type in:

wsl --set-version <distribution name> <versionNumber>

To remove a legacy version of WSL type in:

wsl --unregister Legacy

alse see how to remove old legacy versions of WSL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment