Docker is a very useful tool that simplifies the development and deploy of applications. Docker helps you package your entire application as a package with all the necessary dependencies and then deploy it on a server. Docker run everywhere Windows, Linux or Mac OSX, so you can code your application in any system you like and then deploy it as a containered package.
This packaged application is called container in Docker world. Each container is lightweight since it makes efficient use of RAM and shares the operating system kernel. Secure, since it’s isolated from the rest of the system, and adds an additional layer of security. It’s not a VM. Of course you can run Docker on a VM or bare metal but either way you have a container that it’s isolated and not tied to the underlying infastructure.
It’s opensource and you can find many images provided by community maintainers to get started with at https://hub.docker.com/.
First of all you will need docker to be installed on your machine. I believe you are on Windows host so you will have to install docker toolbox. Find the instructions at https://www.docker.com/products/docker-toolbox.
When you setup is complete start Docker Quickstart Terminal. Now you have a docker-machine with name «default» running at Virtualbox with local IP address 192.168.99.100. More about docker machine at https://docs.docker.com/machine/
Jump to https://hub.docker.com/r/microsoft/dotnet/ This is a .NET Core Docker Image
docker run -it --rm --name mydotnet microsoft/dotnet:latest
Docker downloads microsoft/dotnet image latest version, creates and runs the container with name mydontnet. –rm flag is used to remove any previous containers with the same name. For interactive processes (like a shell), you must use -i -t together in order to allocate a tty for the container process. You now have a container
In case you haven’t noticed we have a linux command prompt starting with root. So run the following.
` mkdir hello_world cd hello_world dotnet new dotnet restore dotnet run `
More samples at https://github.com/dotnet/core/tree/master/samples
As a result we have run a .net core app into docker at windows. The application has a Program.cs that apparently write to the console «Hello World» and has a project.json with the necessary dependencies.
There are more alternatives to install Docker on Windows.
If you want docker command to be available on your console or powershell add the following folder C:\Program Files\Docker Toolbox to Windows PATH.