Installing ASP.NET Core Docker For Windows

Introduction

In this post, we are going to see how we can install ASP.NET Core Docker in our Windows. Before we start, it would be useful if we say something about Docker, right? Docker is a container software platform, where a container is everything on which we need to make our software run. The container is lightweight. You can read more about Docker here. I hope you will like this. Now, let’s begin. 

Background

Today, I was just trying to create a ASP.NET Docker Application in Visual Studio 2017. Unfortunately, I was getting an error as follows.

Error MSB4018 The “PrepareForBuild” task failed unexpectedly.

Microsoft.DotNet.Docker.CommandLineClientException: Unable to run ‘docker-compose’. Verify that Docker for Windows is installed and running locally. For troubleshooting, please review http://aka.ms/DockerToolsTroubleshooting. —> System.ComponentModel.Win32Exception: The system cannot find the file specified

I learned that I had not installed Docker in my machine yet, so I decided to do this.

Asp Net Core Docker Error

ASP.NET Core Docker error

Installing Docker for Windows

You can install Docker from here. Once you downloaded the set up file, please run the file.

Docker For Windows

Docker for Windows

Start and test the Docker

Once you install the Docker, now it is time to test whether everything is installed correctly or not. Prior to it, make sure that the Docker is starting.

Docker is Starting

Docker is starting

There is a hight possibility you will get the error ”Hardware assisted virtualization and data execution protection must be enabled in the BIOS” as the preceeding image.

Docker Error

Docker error

Before you go and change the settings in BIOS, check in Task Manager Window as well.

Hyper V support and Virtulization

Hyper V support and Virtulization

Enabling Virtualization in BIOS

To enable the virtualization in BIOS, go to System Configuration -> Click Virtulization Technology and enable it.

BIOS Settings

BIOS settings

After the restart, the Docker will ask you to start the Service. Go ahead.

Setting up Docker
Docker Service Is Not Runnig Window

Docker Service is not running Windows

Now again, if you are getting an error as “Error MSB4018 The “PrepareForLaunch” task failed unexpectedly.
Microsoft.DotNet.Docker.CommandLineClientException: Creating network “dockercompose3875147227_default” with the default driver
Building linq_basic_to_advanced.
Service ‘linq_basic_to_advanced’ failed to build- Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).”, you need to change your shared drive settings in Docker.

Right click and click on the settings.

Docker Settings

Docker settings

Click Shared Drives and select the drive, which hosts your project and the drive, where %USERPROFILE% resides.

Shared Drive in Docker

Shared drive in Docker

Click Apply and type your filesystem password in the popup given below. Now, if you are running the Edge version of Docker Community Edition for Windows, after the install; you may be able to login with your Docker ID and the password.

Docker SignIn page

Docker SignIn page

We have enough settings for now. Shall we just check whether the installation is done perfectly or not? To check, go to the command Window and type the command as: docker run hello-world.

Docker Check From Command Window

Docker Check from Command Window

You can also check the Docker version with the command docker –version.

Conclusion

Did I miss anything that you may think is needed? Did you find this post useful? I hope you liked this article. Please share your valuable suggestions and feedback with me.

Up Next
    Ebook Download
    View all
    Learn
    View all