Tuesday, December 7, 2021

Installing Docker on Windows

In this tutorial you'll see how to install Docker desktop on windows.

1. Go to https://docs.docker.com/

Click on Download and install.

2. In the next page click on the OS for which you want to check the system requirement. For windows click on "Docker desktop for windows".

3. In the same page you will also see a link to download Docker Desktop for Windows. By clicking that you can download Docker Desktop Installer.exe but before starting to install Docker there are other steps to be taken care of as detailed in System requirements.

4. Enabling WSL2 (Windows Subsystem for Linux version 2) feature on Windows. You can follow the steps as detailed here- https://docs.microsoft.com/en-us/windows/wsl/install

Actually, only a single command is needed now to install everything you need to run Windows Subsystem for Linux (WSL).

wsl --install

You can enter this command in an administrator PowerShell or Windows Command Prompt. This command will enable the required optional components, download the latest Linux kernel, set WSL 2 as your default, and install a Linux distribution for you (Ubuntu by default). Restart the machine after running this command.

5. Download and install the Linux kernel update package. You can download the latest package from this location- https://docs.microsoft.com/en-us/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package

Run the downloaded update package (wsl_update_x64.msi)

6. Once the step 4 and 5 are completed you can install Docker Desktop on Windows. Double-click Docker Desktop Installer.exe to run the installer. When prompted, ensure the Enable Hyper-V Windows Features or the Install required Windows components for WSL 2 option (in our case) is selected on the Configuration page. Follow the instructions on the installation wizard to authorize the installer and proceed with the install.

When the installation is successful, click Close to complete the installation process.

Verifying the installation

Once the Docker installation is completed you can verify that it is correctly installed by using the following steps.

1. On command prompt if you just type docker you should get the list of available options rather than an error.

C:\Users\DockerUser>docker

Usage:  docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Options:
      --config string      Location of client config files (default
                           "C:\\Users\\anshu\\.docker")
  -c, --context string     Name of the context to use to connect to the
                           daemon (overrides DOCKER_HOST env var and
                           default context set with "docker context use")
  -D, --debug              Enable debug mode
  -H, --host list          Daemon socket(s) to connect to

2. You can run the hello-world image which is already stored in Dockerhub.

C:\Users\DockerUser>docker run hello-world

That's all for this topic Installing Docker on Windows. If you have any doubt or any suggestions to make please drop a comment. Thanks!


Related Topics

  1. Docker Tutorial: Introduction to Docker
  2. Run Java Application in Docker Container
  3. Run Python Application in Docker Container
  4. Java Application With User Input in Docker Container

You may also like-

  1. Java Stream - sorted() With Examples
  2. getPath(), getCanonicalPath() and getAbsolutePath() Methods in Java
  3. Java Automatic Numeric Type Promotion
  4. Tree Sort in Java Using Binary Search Tree
  5. Difference Between Abstract Class And Interface in Java
  6. @Required Annotation in Spring Framework
  7. Navigate to a Route Programmatically in Angular
  8. Injector Hierarchy and Service Instances in Angular

No comments:

Post a Comment