11/24/2021»»Wednesday

Install Docker Ubuntu On Windows

Steps to Install and Run Ubuntu 20.04 App by enabling WSL- Windows subsystem for Linux on Windows 11 Windows Subsystem for Linux is the feature that is available in Windows 10 and carries forward to Windows 11 as well. It allows users to run a minimal Linux distro app without using any kind of virtual machine. Install Windows 10 Insider Preview build 18975 (Slow) or later for WSL 2. Install Ubuntu from the Microsoft store. Enable WSL 2 by following this guide. Install the Remote - WSL extension for VS Code. Install the Docker WSL 2 Technical Preview. Once installed, Docker will recognize that you have WSL installed and prompt to enable WSL integration. Follow the instruction to install Windows Sysystem for Linux (Ubuntu). Install Windows ADB and start the ADB server in Windows. Note: Windows’ and WSL’s adb versions must be the same version, e.g., if WSL has ADB 1.0.39, you need to download the corresponding Windows ADB from here. Note: All the following steps will be executed. Windows 10 Docker Ubuntu Desktop. Windows 10 Ubuntu Docker Download. I have VMWare VMs that are necessary for me to use. Installing Docker for Windows enables Hyper-V, which prevents you from being able to use VMWare Workstation or Player. In the future, I would like to see Docker for Windows be able to specify which Virtualization platform to.

Learn the simple commands to use on Powershell for installing Docker on Windows 10 with WSL 2 support for creating an optimized and fast container environment to run various Virtual machine images.

Install

Well, when it comes to installing Docker on Windows 10, most of us struggle with the problem of enabling Hyper-V because it won’t work properly without that. However, if we don’t want to use Hyper-V for Docker installation then using WSL 2 support would be a good idea.

WSL which is already available in the Windows 10 operating system and now comes with the ability to run full-fledged Linux kernel using WSL 2, makes it very easy to operate Docker without Hyper-V or VirtualBox.

Read More:Tutorial to install Docker on Windows 7 without Hyper-V.

Pre-requisites:

  • Windows 10 OS
  • Admin access
  • Powershell
  • WSL- Windows Subsystem for Linux
  • Internet connection

Install Docker using Powershell on Windows 10 with a single command

Install Docker Ubuntu For Windows

Most of us download and use the executable file available on the official website of this containerized platform to set it up, however, you don’t have to do all that. Just use the command line, follow the below steps, and you are done.

Note: Make sure the WSL- Windows subsystem for Linux is already enabled on your system before performing the below-given steps.

Open PowerShell as Admin

We need to have the Administrator access of PowerShell to run the installation command for Docker, thus, right-click on the Windows 10 Start button and select the “Windows PowerShell (Admin)” option.

Windows

Install Chocolatey

Install

Just like Linux packages managers, for example, DNF of CentOS and APT available in Ubuntu, one is also available for Windows operating systems called Chocolatey. The command tool used by this Windows package manager is choco.

Run the below command to enable it in Powershell

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(‘https://chocolatey.org/install.ps1’))

Note: Once the Chocolatey is on your system, close the Powershell and reopen it as Admin.

Command to install Docker Desktop using PowerShell on Windows

Now, everything is ready on Powershell and we can use the Choco command to install Docker on Windows 10 Desktop or Windows Server OS.

When the above command asks for your permission to install the packages, allow it by typing A and hitting the Enter key.

Run Docker Desktop

You will see the icon on your desktop to run this open source containerized platform, double click on that. And start it.

Configure WSL 2 Distro

Although after installing the Docker, it will automatically install its own WSL 2 Linux distro on your system as the default one. Thus, you can easily start using it from PowerShell. In case you want to enable the docker support to other available WSL Linux distros then simply go to the Docker Desktop app, select the Resources option given on the left side, and select WSL integration. You will find all installed and available WSL distros there, use the toggle button given in the front of the distro to enable the support. After that, the particular WSL Linux distro for which you have enabled its support can directly run all the Docker commands without actually installing on that distro.

Extra Tip: Convert WSL 1 distro to WSl 2

In case your WSL distro is still on WSl 1 then you have to first enable the WSL 2 support. For that run your Powershell as Admin and use this command:

Now, go to the Microsoft page to download the WSL 2 kernel update setup, use this link to directly download and upgrade the kernel.

Once all this done, simply restart the system.

Now, open Powershell again as admin and type:

The above command will show all the installed WSL distro on your system. Find out the name of one which you want to convert. For example, we have Ubuntu-18.04 WSL distro and to convert it from WSL 1 to WSL 2, we will run the command:

wsl --set-version distro-name 2

So, as per the example, the command will be like this:

I hope this article somehow helped you, if you have any query please feel free to comment.

March 2, 2020 by Matt Hernandez, @fiveisprime

Last June, the Docker team announced that they will be investing in getting Docker running with the Windows Subsystem for Linux (WSL). All of this is made possible with the recent changes to the architecture of WSL to run within a lightweight virtual machine (VM), which we talked about in an earlier blog post about WSL 2. Since this announcement, the Docker team has released a Technical Preview of Docker that includes support for running with WSL 2.

This article explains how the Docker Desktop technical preview works as well as how to use the Docker extension with the technical preview.

How it works

This new Docker architecture works a lot like Visual Studio Code's WSL remote development support in that the Docker CLI running on the host machine executes commands within the Docker Integration Package, which runs on the remote WSL VM.

Image credit: Docker Engineering

Docker

DockerD runs directly within WSL so there's no need for the Hyper-V VM and all Linux containers run within the Linux userspace on Windows for improved performance and compatibility.

Getting set up

First some prerequisites:

  • Install Windows 10 Insider Preview build 18975 (Slow) or later for WSL 2.
  • Install Ubuntu from the Microsoft store.
  • Enable WSL 2 by following this guide.
  • Install the Remote - WSL extension for VS Code.
  • Install the Docker WSL 2 Technical Preview.
Ubuntu

Once installed, Docker will recognize that you have WSL installed and prompt to enable WSL integration. You want to Enable WSL integration for this tutorial.

This option will allow you to access Docker Desktop via the Docker CLI directly from within your Linux distro.

If you have multiple Linux distros, make sure you only have WSL integration turned on for the correct one in your Docker settings:

With that configured, all commands will execute in the Linux context - this includes Docker commands run from PowerShell so running something like docker run mongo… will start a Linux container within the WSL VM.

Running the docker ps command over in WSL, you'll see the container as expected. Notice that the container ID matches.

Using VS Code

With this set up and running, you can install the VS Code Docker extension and access your containers. If you're already running WSL 2 and the Remote - WSL extension, this will help you get Docker integrated into your WSL workflow rather than switching contexts when you need containers. And because the Docker CLI's context is set to use DockerD in WSL, the extension will work with your containers regardless of whether you opened VS Code using the Remote - WSL extension.

Notice how in the screenshot below, I'm connected and working in WSL and still building/running containers without changing from my preferred environment (zsh in Ubuntu).

Theme: Noctis Sereno

I've personally noticed a vast improvement in container execution times using this configuration and each part of my typical development workflow remains the same. I'm also using the Remote - Containers extension within WSL for testing specific environments without setting things up directly on my machine.

We want your feedback

Keep in mind that you're using prerelease software and, while the Windows Insiders Slow ring is very stable, you may run into some issues. If you do find something that isn't working as expected, please open an issue via the Feedback tool in Windows. Any direct Docker issues or feedback can be logged in the Docker for Windows repo.

Install Docker On Ubuntu Inside Windows

Happy Coding!

Install Docker On Ubuntu On Windows

Matt Hernandez, VS Code Program Manager @fiveisprime

Most Viewed Posts