Skip to content

OCIO y TECnología

  • Privacy Policy
Offcanvas

  • Register
  • Lost your password ?

OCIO y TECnología

  • Home » 
  • Tecnología » 
  • Docker » 
  • Install WSL2 + Docker on Windows

Install WSL2 + Docker on Windows

Emilio González Montaña 2024/02/09 0

This post is a serial of update steps (2024) to install Windows Subsystem for Linux (WSL) v2 including deploying Docker service on it at the end.

Table of Contents

  • Requirements
    • Hyper-V
    • Windows Terminal
  • WSL installation
  • Ubuntu preparation
    • Ubuntu updates
    • Systemd
  • Docker

Requirements

First ensure you have latest Windows updates installed. You must be running Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11.

Hyper-V

Also ensure Hyper-V is enabled under Windows features (to open this dialog press WINDOWS key and type Turn Windows features on or off):

Enabling Hyper-V on Windows Features
Applying changes on Windows Features

Windows Terminal

Optionally install Windows Terminal APP via Windows store:

Installing Terminal APP via Windows store

WSL installation

Now open the terminal an use wsl command to be installed via:

wsl --install
Installing WSL from Windows PowerShell

When asked allow the pop-up message to scale up privileges (it could be requested several times):

Confirming Windows administration permission
Confirming Windows administration permission

Ubuntu will be installed by default (check options of previous command if you prefer other distribution):

Installing Ubuntu virtual machine on WSL

After installation you will need to reboot Windows:

Ubuntu distribution is installed on WSL

After rebooting Windows, a terminal window will appear automatically to finish Ubuntu installation:

Finishing Ubuntu installation first time it is open

It will take a while to install, when it finishes press any key to close the window.

If when it finishes you receive a message that virtualization is not enabled in the BIOS, please check it rebooting Windows and entering your BIOS settings, typically under CPU settings:

Ubuntu finishes with an error due to virtualization is not enabled on BIOS settings

Now you can open Terminal APP and under the triangle of the + symbol select Ubuntu (you could change which one to open by default in Settings menu):

Open Ubuntu distribution on Windows Terminal application

First time it will need to finish Ubuntu installation:

First time Ubuntu is open it will take a few to finish the installation process

Once installed you will need to fill username & password (twice):

Enter new credentials (username + password) on first init
First successful Ubuntu init

Ubuntu preparation

Ubuntu updates

First thing is to update Ubuntu with:

sudo apt update
sudo apt dist-upgrade

Systemd

Then we need to ensure systemd is enabled in wsl settings, edit the file /etc/wsl.conf and check these lines are present:

[boot]
systemd=true

Docker

Now, we install docker.io and add your user to docker group to be able to run docker commands with your user (not requiring root user):

sudo apt install docker.io
sudo adduser emilio docker

Close the terminal and open it again to apply permissions changes, after this you can check the installed version and run a hello-world container:

$ docker --version
Docker version 24.0.5, build 24.0.5-0ubuntu1~22.04.1
$ docker run -it --rm hello-world
Testing Docker version & running hello world image

All is done! 🙂

Comparte esto:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
Tags : Tags docker   Linux   terminal   Ubuntu   Windows   WSL   WSL2
Share
facebookShare on FacebooktwitterShare on TwitterpinterestShare on Pinterest
linkedinShare on LinkedinvkShare on VkredditShare on ReddittumblrShare on TumblrviadeoShare on ViadeobufferShare on BufferpocketShare on PocketwhatsappShare on WhatsappviberShare on ViberemailShare on EmailskypeShare on SkypediggShare on DiggmyspaceShare on MyspacebloggerShare on Blogger YahooMailShare on Yahoo mailtelegramShare on TelegramMessengerShare on Facebook Messenger gmailShare on GmailamazonShare on AmazonSMSShare on SMS
Post navigation
Previous post

Disable Ubuntu Pro marketing on APT updates

Next post

APT kept back packages

Emilio González Montaña

Related Posts

Categories Linux  Networking  Tecnología Install WSL2 + Docker on Windows

Detachable screens to avoid SSH disconnections

Categories Linux  Networking  Tecnología Install WSL2 + Docker on Windows

Expose WSL2 port to the network

Categories Data bases  Docker  Tecnología Install WSL2 + Docker on Windows

Recover corrupted Postgres DB WAL

Leave a Comment Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • Detachable screens to avoid SSH disconnections
  • Expose WSL2 port to the network
  • Rosaleda (parque El Retiro, Madrid)
  • Back to the painting table
  • Recover corrupted Postgres DB WAL

Categories

  • Aficiones
  • AI
  • Bricolage
  • Data bases
  • Docker
  • Escenografía
  • Eventos
  • Fotografía
  • Hardware
  • Linux
  • Networking
  • Partidas
  • Proxmox
  • Sin categoría
  • Tecnología
  • Utils
  • Viajes
  • Virtualization
  • Warhammer
  • YAML

Tags

anthill (1) apt (5) cellular-automatons (1) ceph (2) context (1) conways-life (1) cortador (1) debian (3) docker (9) docker-compose.yml (4) docker-swarm (5) DRY (1) El Imperio (2) Enanos (2) escenografía (3) fotos (3) GlusterFS (1) Guerreros del Caos (2) informática (1) Linux (8) M.2 (1) Mac (1) Madrid (2) maqueta (2) MariaDB (2) miniaturas (4) MySQL (2) NFS (2) NVMe (1) partida (2) poliestireno (1) portainer (1) proxmox (2) rocas (1) Sony A65 (2) SSH (5) ssh-key (1) Ubuntu (8) update (2) volume (1) Warhammer (11) Windows (3) WSL (2) WSL2 (2) YAML (1)

Archives

  • June 2024
  • May 2024
  • April 2024
  • February 2024
  • January 2024
  • September 2023
  • August 2023
  • June 2023
  • December 2021
  • April 2021
  • May 2020
  • April 2020
  • March 2020
  • November 2019
  • July 2018
  • February 2017
  • June 2015
  • April 2014
  • April 2011
  • January 2011
  • July 2010
  • June 2010
  • March 2010
  • November 2009
  • June 2009
  • December 2008
  • November 2008
  • October 2008
  • June 2008
  • May 2008
  • October 2007

Meta

  • Register
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Copyright © 2025 OCIO y TECnología - Powered by Nevothemes.
Offcanvas