12/27/2021

Install Docker Using Powershell

27

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.

  1. Install Docker Using Powershell Windows 10
  2. Install Docker On Windows Using Powershell
  3. Install Docker Using Powershell

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.

Sep 05, 2021 In the following Dockerfile code, I build a Docker image using Ubuntu latest image and installing the latest PowerShell 7 image. The last line is optional, and in that line, I run the RUN statement with parameters. The line runs a PowerShell 7 command that prints out the version of PowerShell. FROM ubuntu ENV builddir=build RUN mkdir. Mar 03, 2020 Using PowerShell in Docker.; 2 minutes to read; s; a; In this article. We publish Docker images with PowerShell preinstalled. This article shows you how to get started using PowerShell in the Docker container. Finding available images. The released images require Docker 17.05 or newer.

  1. Oct 03, 2021 Base operating system can be installed using ContainerImage PowerShell module. Install the module as: See the list of operating system images that are available: Docker Install Powershell Commands. Install the Windows Server Core base OS image: Install Docker on Windows Server 2016. Download the script to install Docker: Run the script: Check.
  2. Install Docker Powershell Windows Server 2019; Install IIS from command line windows 10. As Windows come with inbuilt IIS thus we don’t need to download it, however, by default it will not enable, therefore, we install this Internet Information Services feature either by enabling it using the GUI method that is via “Turn Windows features on.

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

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.

Install Docker Using Powershell

Install Chocolatey

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’))

Install docker using powershell java

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

Install Docker Using Powershell

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:

Using

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:

Install Docker Using Powershell Windows 10

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:

Install Docker On Windows Using Powershell

wsl --set-version distro-name 2

Install Docker Using Powershell

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.

  • Most Viewed News

    • Download High Sierra From El Capitan
    • Install Systemctl In Docker Container
    • Grid Autosport Mac Download
    • Mac Os Sierra Dmg File
    • Os Mojave Installer