Set-up a new Asp.Net Core 2.1 Project with Docker

September 23, 2018

Until recently, I’ve pretty much managed to avoid the container revolution. However, as the tools are becoming much more integrated, and the technology much more pervasive, I thought I’d document my journey into the world of containers.

As far as I can tell, the battle between types of containers and orchestrators is now over, and the VHS has emerged as Docker and Kubernetes; at least, MS, Google and Amazon seem to think so.

Docker - from step 0

Let’s follow the process through from nothing; the first step is to visit the Docker Store here.

Once you’re there, you’ll need to pick a username and sign in. After this, you can download Docker for Windows:

docker 1

docker 2

Once downloaded, run it, and you’ll see this bizarre screen, that seemingly lives in your way:

docker 3

You can just close this: docker actually lives in your system tray. Right click there and select Settings:

docker 4

Share your drive that you’re planning to run your Asp.Net Core code from.

By default, docker installs with a Linux bias, so the next step is to switch to Windows Containers (again in the right-click context menu):

docker 5

Finally, some code…

Okay, Docker is now primed and ready to run a container. Let’s create our new project:

docker 6

After you okay this, you’ll notice that there’s a new “Add Docker Support” in the create Project dialogue:

docker 7

Once you create this (and persuade your browser and Docker that you’re not too bothered about certificates for the minute) it should run out of the box:

docker 8

To prove it’s running, open Power Shell and type:



 docker ps

docker 8 1

Or, to take the more brute force approach by just restarting docker and have a look at VS:

docker 9

References

https://stackify.com/azure-container-instances/

https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/docker/visual-studio-tools-for-docker?view=aspnetcore-2.1



Profile picture

A blog about one man's journey through code… and some pictures of the Peak District
Twitter

© Paul Michaels 2024