<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>asp.net on docker &#8211; ASP.NET Hosting Reviews and Guides</title>
	<atom:link href="https://topreviewhostingasp.net/tag/asp-net-on-docker/feed/" rel="self" type="application/rss+xml" />
	<link>https://topreviewhostingasp.net</link>
	<description>ASP.NET Hosting &#124; Reviews &#124; Tips &#38; Tutorial</description>
	<lastBuildDate>Fri, 10 Aug 2018 05:10:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://topreviewhostingasp.net/wp-content/uploads/2017/01/cropped-trhaico-32x32.png</url>
	<title>asp.net on docker &#8211; ASP.NET Hosting Reviews and Guides</title>
	<link>https://topreviewhostingasp.net</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to Host ASP.NET Core 2.0 Application in Docker</title>
		<link>https://topreviewhostingasp.net/how-to-host-asp-net-core-2-0-application-in-docker/</link>
					<comments>https://topreviewhostingasp.net/how-to-host-asp-net-core-2-0-application-in-docker/#respond</comments>
		
		<dc:creator><![CDATA[Jacques Hunt]]></dc:creator>
		<pubDate>Fri, 10 Aug 2018 05:10:00 +0000</pubDate>
				<category><![CDATA[Hosting Tips]]></category>
		<category><![CDATA[asp.net core docker]]></category>
		<category><![CDATA[asp.net core tips]]></category>
		<category><![CDATA[asp.net core tutorial]]></category>
		<category><![CDATA[asp.net host on docker]]></category>
		<category><![CDATA[asp.net on docker]]></category>
		<guid isPermaLink="false">https://topreviewhostingasp.net/?p=2219</guid>

					<description><![CDATA[In today&#8217;s article, we will create an ASP.NET Core 2.0 MVC web application with Docker support and then, we will deploy our application in a Docker container (Windows 10). Why do we need this? The main purpose of Docker is to deploy applications to the production environment or other environments as required by Ops. However, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In today&#8217;s article, we will create an ASP.NET Core 2.0 MVC web application with Docker support and then, we will deploy our application in a Docker container (Windows 10).</p>
<p><strong>Why do we need this?</strong></p>
<p>The main purpose of Docker is to deploy applications to the production environment or other environments as required by Ops. However, the highlight of Docker lies in the process of deploying it.</p>
<p>Till Docker came into the picture, the traditional approach to deployment was via Virtual Machines (VM). And let’s not get started with the drawbacks of VMs because there are a plenty. Starting from the effort required to boot a VM, to launching multiple VMs in the same machine, it is a tough task to get things running with VMs.</p>
<p>So first, let’s see what does Docker provide?</p>
<p>Docker provides a container environment which can be used to host any application of your choice. The software application and the dependencies which support it are <em>tightly-packaged</em> together.</p>
<p>This packaged product is called a Container. Since it is done by Docker, it is called a Docker container!</p>
<p><strong>Benefits of Docker container?</strong></p>
<p>Since the application and its dependencies are packaged together, there is no external dependency for the app to run. This means the container is very light-weight.</p>
<p>Because it is light-weight, it can be easily shipped to other machines and be executed on those machines, irrespective of their host OS/ configurations.</p>
<p>The only requirement being, <em>Docker has to be installed</em> to run that application residing in the container.</p>
<p>So let&#8217;s get started.</p>
<p>We will install docker for windows (we are using windows 10).</p>
<p>For that go to the following link &#8211; <em>https://store.docker.com/editions/community/docker-ce-desktop-windows</em></p>
<p>You will need to login in order to download this. Once you have downloaded the setup and installed then restart your system.</p>
<p>After restarting go to command prompt and type docker version</p>
<p>You should see something like this in your console.</p>
<p style="text-align: center;"><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-2220" src="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_1.png" alt="" width="601" height="314" srcset="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_1.png 601w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_1-300x157.png 300w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_1-50x26.png 50w" sizes="(max-width: 601px) 100vw, 601px" /></p>
<p>It means that docker is successfully installed in your machine. Now we will create our ASP.NET Core 2.0 MVC application.</p>
<p style="text-align: center;"><img decoding="async" class="alignnone size-full wp-image-2221" src="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_2.jpg" alt="" width="602" height="420" srcset="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_2.jpg 602w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_2-300x209.jpg 300w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_2-50x35.jpg 50w" sizes="(max-width: 602px) 100vw, 602px" /></p>
<p>Make sure to check Enable Docker Support  checkbox and select your OS (mine is windows)</p>
<p>Once the project is created then you will see some docker files in the solution explorer,</p>
<p style="text-align: center;"><img decoding="async" class="alignnone size-full wp-image-2222" src="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_3.png" alt="" width="324" height="342" srcset="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_3.png 324w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_3-284x300.png 284w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_3-47x50.png 47w" sizes="(max-width: 324px) 100vw, 324px" /></p>
<p>When we open Dockerfile,</p>
<p style="text-align: center;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2223" src="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_4.png" alt="" width="544" height="378" srcset="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_4.png 544w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_4-300x208.png 300w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_4-50x35.png 50w" sizes="(max-width: 544px) 100vw, 544px" /></p>
<p>These are the contents of the auto-generated file.</p>
<p>What this file does is defines the dependencies which are required for our application and when we host our application in docker then this file is read by the docker to get the dependencies and get the entry point for our application.</p>
<p>So our application part is done. Now we will simply host our application in the docker container.</p>
<p>For that open command prompt and go to the project location where DockerFile resides and type docker-compose build and hit enter.</p>
<p style="text-align: center;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2224" src="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_5.png" alt="" width="602" height="109" srcset="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_5.png 602w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_5-300x54.png 300w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_5-50x9.png 50w" sizes="(max-width: 602px) 100vw, 602px" /></p>
<p>You will see some processes, let them execute</p>
<p>After all the steps are done you should see something like this,</p>
<p style="text-align: center;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2225" src="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_6.png" alt="" width="506" height="161" srcset="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_6.png 506w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_6-300x95.png 300w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_6-50x16.png 50w" sizes="(max-width: 506px) 100vw, 506px" /></p>
<p>After this to see the images type docker images and hit enter,</p>
<p style="text-align: center;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2226" src="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_7.png" alt="" width="602" height="106" srcset="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_7.png 602w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_7-300x53.png 300w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_7-50x9.png 50w" sizes="(max-width: 602px) 100vw, 602px" /></p>
<p>You should see your application like this. So this is our image. But the image is just a template, we cannot connect to it, to run it we have to put this image inside a container and the run that container. So for that, we will copy its image id and type docker run your_image_id,</p>
<p style="text-align: center;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2227" src="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_8.png" alt="" width="602" height="116" srcset="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_8.png 602w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_8-300x58.png 300w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_8-50x10.png 50w" sizes="(max-width: 602px) 100vw, 602px" /></p>
<p>As you can see now our application is running. So to open it in our browser we need IP address of our container which has the image. To check that type docker ps –a and hit enter,</p>
<p style="text-align: center;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2228" src="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_9.png" alt="" width="602" height="83" srcset="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_9.png 602w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_9-300x41.png 300w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_9-50x7.png 50w" sizes="(max-width: 602px) 100vw, 602px" /></p>
<p>Here we can see our container that is just been created and now to get the IP address of our container type docker inspect your_container_id</p>
<p>It will give you information about your container like this</p>
<p style="text-align: center;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2229" src="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_10.png" alt="" width="602" height="300" srcset="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_10.png 602w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_10-300x150.png 300w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_10-50x25.png 50w" sizes="(max-width: 602px) 100vw, 602px" /></p>
<p>You will get all of this information, now scroll down and look for NetworkSettings</p>
<p style="text-align: center;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2230" src="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_11.png" alt="" width="601" height="436" srcset="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_11.png 601w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_11-300x218.png 300w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_11-50x36.png 50w" sizes="(max-width: 601px) 100vw, 601px" /></p>
<p>You will need this highlighted IP address.</p>
<p>There is another way to get this IP Address and that is to type the following</p>
<p>docker inspect -f &#8220;{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}&#8221;  your_container_id</p>
<p style="text-align: center;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2231" src="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_12.png" alt="" width="602" height="57" srcset="https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_12.png 602w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_12-300x28.png 300w, https://topreviewhostingasp.net/wp-content/uploads/2018/08/image_12-50x5.png 50w" sizes="(max-width: 602px) 100vw, 602px" /></p>
<p>So now that we have got the IP address just enter this address in the browser. And you can see that your application running on a docker container.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://topreviewhostingasp.net/how-to-host-asp-net-core-2-0-application-in-docker/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
