Advertise with Googlier.com  Steve Spencer's Blog - Docker Blogging on Azure Stuff http://blogs.recneps.net/ http://www.rssboard.org/rss-specification BlogEngine.NET 2.9.1.0 en-US http://blogs.recneps.net/opml.axd http://www.dotnetblogengine.net/syndication.axd Steve Spencer Steve Spencer's Blog 0.000000 0.000000 DotNetSheff Slides <p><img alt="" src="https://pbs.twimg.com/media/C6ViLMoWQAIpZa9.jpg" width="502" height="376"></p> <p>I presented at <a href="https://www.meetup.com/dotnetsheff/">DotNetSheff</a>&nbsp; on Tues 7th March</p> <p>The slides for the two talks are here:</p> <p><a href="http://recneps.blob.core.windows.net/slides/BuildingScalableResilientWebsitesinAzure20170307.pptx">Building Scalable Resilient Web Apps in Azure</a></p> <p><a href="http://recneps.blob.core.windows.net/slides/ServiceFabricOverview-DotNetShef20170307.pptx">Introduction to Azure Service Fabric</a></p> http://blogs.recneps.net/post/DotNetSheff-Slides http://blogs.recneps.net/post/DotNetSheff-Slides#comment http://blogs.recneps.net/post.aspx?id=9e320f2e-d217-4ba5-a798-056416686d5f Thu, 09 Mar 2017 21:07:02 +0000 Azure App Service Azure Azure Websites Microsoft Azure Service Fabric Docker Windows Containers steve http://blogs.recneps.net/pingback.axd http://blogs.recneps.net/post.aspx?id=9e320f2e-d217-4ba5-a798-056416686d5f 44 http://blogs.recneps.net/trackback.axd?id=9e320f2e-d217-4ba5-a798-056416686d5f http://blogs.recneps.net/post/DotNetSheff-Slides#comment http://blogs.recneps.net/syndication.axd?post=9e320f2e-d217-4ba5-a798-056416686d5f Custom ASP.NET MVC app running in a Container on Service Fabric <p>In an <a href="http://blogs.recneps.org/post/Custom-ASPNET-MVP-app-running-in-a-Windows-Container">earlier post</a>, I talked about how to create a Docker container on Windows that housed a custom ASP.Net MVC app. What I want to show now is how you can get this container running in Service Fabric.</p> <p>I created 3 identical virtual machines all capable of running Docker as in my earlier post. Now I needed to make my three VMs into a Service fabric cluster. These two posts explain how:</p> <p><a href="https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-get-started">https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-get-started</a> <p><a href="https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-cluster-standalone-deployment-preparation">https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-cluster-standalone-deployment-preparation</a> <p>My 3 VMs are called sf0, sf1 &amp; sf2 and I needed to&nbsp; put these into my cluster config. I picked the ClusterConfig.Unsecure.MultiMachine config file that comes with the Service Fabric files and changed it to include my 3 VMs, so my nodes look like this: <p><strong><em><font color="#0000ff"><font size="1">"nodes": [</font><br><font size="1">{</font><br><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "nodeName": "sf0",</font><br><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">"iPAddress": "sf0",</font><br><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">"nodeTypeRef": "NodeType0",</font><br><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">"faultDomain": "fd:/dc1/r0",</font><br><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">"upgradeDomain": "UD0"</font><br><font size="1">},</font><br><font size="1">{</font><br><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">"nodeName": "sf1",</font><br><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">"iPAddress": "sf1",</font><br><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">"nodeTypeRef": "NodeType0",</font><br><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">"faultDomain": "fd:/dc2/r0",</font><br><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">"upgradeDomain": "UD1"</font><br><font size="1">},</font><br><font size="1">{</font><br><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">"nodeName": "sf2",</font><br><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">"iPAddress": "sf2",</font><br><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">"nodeTypeRef": "NodeType0",</font><br><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">"faultDomain": "fd:/dc3/r0",</font><br><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="1">"upgradeDomain": "UD2"</font><br><font size="1">}</font><br><font size="1">],</font></font></em></strong></p> <p>I then remoted onto one of the machines and ran the following PowerShell:</p> <p><font color="#0000ff"><em><strong>.\TestConfiguration.ps1 -ClusterConfigFilePath .\ClusterConfig.json</strong></em></font> <p>This will check all the machines in the ClusterConfig.json file to see if they are configured correctly and report any errors. I got the following error: <p><strong><em>Machine 'sf2' is not reachable on port 445. Check connectivity/open ports. Error: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 192.168.1.222:445</em></strong> <p>This meant I needed to open the correct firewall ports on my VM. I got this error for all the machines in the cluster. Once I fixed this and reran the PowerShell, the tests passed which meant I could install Service Fabric on each of the machines as follows: <p><strong><em><font color="#0000ff">.\CreateServiceFabricCluster.ps1 -ClusterConfigFilePath .\ClusterConfig.json –AcceptEULA</font></em></strong> <p>When this completes successfully you should see something like this: <p><strong><em>Your cluster is successfully created! You can connect and manage your cluster using Microsoft Azure Service Fabric Explorer or Powershell. To connect through Powershell, run 'Connect-ServiceFabricCluster </em></strong> <p>I could connect to Service Fabric Explorer using: <a href="http://sf0:19080">http://sf0:19080</a> <p>Now I have my cluster running I needed to create a Service Fabric App and deploy it to the cluster. Make sure that you have installed the Service Fabric SDK, then run Visual Studio. Create a new Service Fabric project. When the project is created, right click on the services node, Select Add-&gt;New Service Fabric Service <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image001%5B4%5D.png"><img title="clip_image001[4]" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="clip_image001[4]" src="http://blogs.recneps.org/image.axd?picture=clip_image001%5B4%5D_thumb.png" width="457" height="204"></a> <p>Then pick Guest Container and enter the name in your Docker Hub repository where your Docker image resides. <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image001_5.png"><img title="clip_image001" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="clip_image001" src="http://blogs.recneps.org/image.axd?picture=clip_image001_thumb_5.png" width="536" height="394"></a> <p>This will add in the necessary files to your service fabric project. If you remember from my <a href="http://blogs.recneps.org/post/Custom-ASPNET-MVP-app-running-in-a-Windows-Container">earlier post</a>, the website was hosted on port 8000 of the container. We need to tell service fabric about this and also we may want to map this to a different port.</p> <p>If you open the containers ServiceManifest file</p> <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image001%5B8%5D_1.png"><img title="clip_image001[8]" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; display: inline; padding-right: 0px" border="0" alt="clip_image001[8]" src="http://blogs.recneps.org/image.axd?picture=clip_image001%5B8%5D_thumb_1.png" width="220" height="190"></a></p> <p>Add an endpoint with the endpoint you want Service Fabric to use to publish the website out</p> <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image001%5B10%5D_1.png"><img title="clip_image001[10]" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="clip_image001[10]" src="http://blogs.recneps.org/image.axd?picture=clip_image001%5B10%5D_thumb_1.png" width="508" height="130"></a></p> <p>In this example I’m using the same port. If you want to map the port to a different one then changes this to something else e.g. If I wanted to use <a href="http://sf0:8080">http://sf0:8080</a> as the website then I would change the Service Manifest to this:</p> <p><a href="http://blogs.recneps.org/image.axd?picture=image_24.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://blogs.recneps.org/image.axd?picture=image_thumb_24.png" width="513" height="112"></a></p> <p>You also need to tell service fabric about the Container port that is published. This is done in the application manifest file:</p> <p><a href="http://blogs.recneps.org/image.axd?picture=image_25.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://blogs.recneps.org/image.axd?picture=image_thumb_25.png" width="635" height="146"></a></p> <p>This is set to 8000 as that is the port exposed by the Docker container</p> <p>Now deploy your application to service fabric. It may take a while to initialise your container as it will need to be downloaded from Docker Hub before it will run. Once it is running you should see it as Ready in the Service Fabric Explorer</p> <p><a href="http://blogs.recneps.org/image.axd?picture=image_26.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://blogs.recneps.org/image.axd?picture=image_thumb_26.png" width="706" height="547"></a></p> http://blogs.recneps.net/post/Custom-ASPNET-MVC-app-running-in-a-Container-on-Service-Fabric http://blogs.recneps.net/post/Custom-ASPNET-MVC-app-running-in-a-Container-on-Service-Fabric#comment http://blogs.recneps.net/post.aspx?id=722c760c-d258-4fa7-b854-7a08a765251f Sun, 05 Mar 2017 11:26:53 +0000 Azure Docker Microsoft Azure Service Fabric steve http://blogs.recneps.net/pingback.axd http://blogs.recneps.net/post.aspx?id=722c760c-d258-4fa7-b854-7a08a765251f 377 http://blogs.recneps.net/trackback.axd?id=722c760c-d258-4fa7-b854-7a08a765251f http://blogs.recneps.net/post/Custom-ASPNET-MVC-app-running-in-a-Container-on-Service-Fabric#comment http://blogs.recneps.net/syndication.axd?post=722c760c-d258-4fa7-b854-7a08a765251f Custom ASP.NET MVC app running in a Windows Container <p>With the introduction of Windows Containers on&nbsp; Window Server 2016 and the ability to run containers in Service Fabric I thought it was time to investigate Windows Containers and I wanted to know how to build one that will run a web site using IIS.</p> <p>As I’m new to containers, although I’ve done a very similar exercise with Docker on Linux, I decided to follow the <a href="https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/quick-start-windows-server">Windows Quick Start Guide</a>. I hit a few problems early on so I’ve put the steps I followed here:</p> <p>After opening a PowerShell window as administrator I ran the following commands:</p><strong><em><font face="Consolas">Install-Module -Name DockerMsftProvider -Repository PSGallery –Force</font> </em></strong>– Ran OK<br><strong><em><font face="Consolas">Install-Package -Name docker -ProviderName DockerMsftProvider</font> </em></strong>– Had an error <br><font color="#ff0000" size="1">WARNING: Cannot verify the file SHA256. Deleting the file.</font> <br><font color="#ff0000" size="1">WARNING: C:\Users\ADMINI~1.DEV\AppData\Local\Temp\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip does not exist</font> <br><font color="#ff0000" size="1">Install-Package : Cannot find path 'C:\Users\ADMINI~1.DEV\AppData\Local\Temp\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip' because it does not exist.</font> <br> <p>&nbsp; <p>Not sure what was causing this to fail but I followed the instructions to manually install (from <a href="https://github.com/OneGet/MicrosoftDockerProvider/issues/15">https://github.com/OneGet/MicrosoftDockerProvider/issues/15</a>) <p><font face="Consolas"><strong><em>Start-BitsTransfer -Source https://dockermsft.blob.core.windows.net/dockercontainer/docker-1-12-2-cs2-ws-beta.zip</em></strong><strong><em> -Destination /docker.zip </em></strong><br><strong><em>Get-FileHash -Path /docker.zip -Algorithm SHA256 </em></strong><br><strong><em>mkdir C:\Users\Administrator\AppData\Local\Temp\DockerMsftProvider\</em></strong> <br><strong><em>cp .\docker.zip C:\Users\Administrator\AppData\Local\Temp\DockerMsftProvider\ </em></strong><br><strong><em>cd C:\Users\Administrator\AppData\Local\Temp\DockerMsftProvider\ </em></strong><br><strong><em>cp .\docker.zip Docker-1-12-2-cs2-ws-beta.zip </em></strong><br><strong><em>Install-Package -Name docker -ProviderName DockerMsftProvider -Verbose </em></strong><strong><em>Restart-Computer –Force</em></strong><br></font></p> <p>After Rebooting I tried to download and run a sample container</p> <p><font face="Consolas"><strong><em>docker run microsoft/dotnet-samples:dotnetapp-nanoserver</em></strong></font></p> <p><font face="Arial">but I got the following error</font></p> <p><font color="#ff0000" size="1">docker : C:\Program Files\Docker\docker.exe: error during connect: Post </font><a href="http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.25/containers/create"><font color="#ff0000" size="1">http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.25/containers/create</font></a><font color="#ff0000" size="1">: open //./pipe/docker_engine: The </font> <p><font color="#ff0000" size="1">system cannot find the file specified..</font> <p><font color="#ff0000" size="1">At line:1 char:1</font> <p><font color="#ff0000" size="1">+ docker run microsoft/dotnet-samples:dotnetapp-nanoserver</font> <p><font color="#ff0000" size="1">+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</font> <p><font color="#ff0000" size="1">+ CategoryInfo : NotSpecified: (C:\Program File...ile specified..:String) [], RemoteException</font> <p><font color="#ff0000" size="1">+ FullyQualifiedErrorId : NativeCommandError</font> <p>It turns out that the docker service wasn’t running after the reboot, so open services.msc and find the docker service to start it. <p>Running the same command again will download the image from docker hub, create a container from it and then run it. As this is a visual container it runs once and then stops. <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image001_4.png"><img title="clip_image001" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image001" src="http://blogs.recneps.org/image.axd?picture=clip_image001_thumb_4.png" width="422" height="431"></a> <p>Every time I do <strong><em>docker run microsoft/dotnet-samples:dotnetapp-nanoserver</em></strong> it creates a new container. What I want to do is to run one that is stopped and view the output on the screen.</p> <p>For this I needed to start the container I had already created. If you run </p> <p><font face="Consolas"><strong><em>docker –ls –a</em></strong></font></p> <p>This will list all the containers that are both running and stopped and you can see from the image below that I had run docker run a number of time. Each time it tried to download the image (which was already downloaded) and then create a new container from it.</p> <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image001%5B6%5D.png"><img title="clip_image001[6]" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image001[6]" src="http://blogs.recneps.org/image.axd?picture=clip_image001%5B6%5D_thumb.png" width="994" height="74"></a></p> <p><font face="Consolas"><strong><em>docker container start -a 12d382ae0bd6</em></strong></font> (-a attached STDOUT so you can see the output)</p> <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image001%5B8%5D.png"><img title="clip_image001[8]" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image001[8]" src="http://blogs.recneps.org/image.axd?picture=clip_image001%5B8%5D_thumb.png" width="415" height="567"></a></p> <p>Now I know how to create and start containers I wanted to build one of my own. This is easier than I first though as there a lots of base templates stored on docker hub and git hub. </p> <p><a title="https://docs.microsoft.com/en-us/virtualization/windowscontainers/samples#Application-Frameworks" href="https://docs.microsoft.com/en-us/virtualization/windowscontainers/samples#Application-Frameworks">https://docs.microsoft.com/en-us/virtualization/windowscontainers/samples#Application-Frameworks</a></p><a title="https://hub.docker.com/r/microsoft/" href="https://hub.docker.com/r/microsoft/">https://hub.docker.com/r/microsoft/</a> <p>I picked one on docker hub that has IIS and ASP.Net installed already, so all I needed to do after was to add my own website and configure IIS correctly. Using docker pull,</p> <p><font face="Consolas"><strong><em>docker pull microsoft/aspnet</em></strong></font> (see <a title="https://hub.docker.com/r/microsoft/aspnet/" href="https://hub.docker.com/r/microsoft/aspnet/">https://hub.docker.com/r/microsoft/aspnet/</a>) <p>This retrieves the template from Docker Hub and I want to use that template to install my ASP.Net MVC site and configure IIS to serve the pages on port 8000. Following the instructions here (<a href="https://docs.microsoft.com/en-us/dotnet/articles/framework/docker/aspnetmvc">https://docs.microsoft.com/en-us/dotnet/articles/framework/docker/aspnetmvc</a>). I published my MVC site and copied the publish folder to my docker machine. Then I needed to create a Dockerfile recipe to instruct docker what to install in my image. So I created a folder that contained the Dockerfile and also the published website as below <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image001%5B10%5D.png"><img title="clip_image001[10]" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image001[10]" src="http://blogs.recneps.org/image.axd?picture=clip_image001%5B10%5D_thumb.png" width="178" height="61"></a> </p> <p>The contents of the Dockerfile are: </p> <p><font face="Consolas"><strong><em># The FROM instruction specifies the base image. You are</em></strong></font><br><font face="Consolas"><strong><em># extending the microsoft/aspnet image.</em></strong></font><br><font face="Consolas"><strong><em>FROM microsoft/aspnet</em></strong></font><br><font face="Consolas"><strong><em># Next, this Dockerfile creates a directory for your application</em></strong></font><br><font face="Consolas"><strong><em>RUN mkdir C:\sdsweb</em></strong></font><br><font face="Consolas"><strong><em># configure the new site in IIS.</em></strong></font><br><font face="Consolas"><strong><em>RUN powershell -NoProfile -Command \</em></strong></font><br><font face="Consolas"><strong><em>Import-module IISAdministration; \</em></strong></font><br><font face="Consolas"><strong><em>New-IISSite -Name "sdsweb" -PhysicalPath C:\sdsweb -BindingInformation "*:8000:"</em></strong></font><br><font face="Consolas"><strong><em># This instruction tells the container to listen on port 8000. </em></strong></font><br><font face="Consolas"><strong><em>EXPOSE 8000</em></strong></font><br><font face="Consolas"><strong><em># The final instruction copies the site you published earlier into the container.</em></strong></font><br><font face="Consolas"><strong><em>ADD sdswebsource/ /sdsweb</em></strong></font><br></p> <p>Now I need to run this to create the image <p>In PowerShell, I changed directory to the folder containing my Dockerfile, then ran <p><font face="Consolas"><strong><em>docker build -t sdsweb .</em></strong></font> <p>This has created an image and we need to now get this running as a container <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image001%5B12%5D.png"><img title="clip_image001[12]" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image001[12]" src="http://blogs.recneps.org/image.axd?picture=clip_image001%5B12%5D_thumb.png" width="693" height="82"></a> <p>using docker run again <p><strong><em><font face="Consolas">docker run -d -p 8000:8000 --name sdsweb sdsweb</font></em></strong> <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image001%5B14%5D.png"><img title="clip_image001[14]" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image001[14]" src="http://blogs.recneps.org/image.axd?picture=clip_image001%5B14%5D_thumb.png" width="700" height="68"></a> <p>My container is now running and I should be able to view the web pages in my browser on port 8000, but I need to know the IP address first <p><strong><em><font face="Consolas">docker inspect -f "{{ .NetworkSettings.Networks.nat.IPAddress }}" sdsweb</font></em></strong> <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image001%5B16%5D.png"><img title="clip_image001[16]" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image001[16]" src="http://blogs.recneps.org/image.axd?picture=clip_image001%5B16%5D_thumb.png" width="757" height="48"></a> <p>Now I can browser to <a href="http://172.17.97.235:8000">http://172.17.97.235:8000</a> </p> <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image001%5B18%5D.png"><img title="clip_image001[18]" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image001[18]" src="http://blogs.recneps.org/image.axd?picture=clip_image001%5B18%5D_thumb.png" width="605" height="342"></a></p> <p>I changed the default web page to show the machine name serving the pages under Getting Started. Listing the containers will show the container ID and this matches the machine name displayed on the web page</p> <p><a href="http://blogs.recneps.org/image.axd?picture=image_19.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://blogs.recneps.org/image.axd?picture=image_thumb_19.png" width="391" height="56"></a></p> <p>That’s it running in a container. There are a couple more things I’d like to do before I’ve finished. The first is to make sure that when my Windows Server restarts, then my sdsweb container also starts. At the moment it will not start as I didn’t add a restart parameter when I called docker run. Adding –restart always will cause the container to restart when windows restarts.</p> <p><strong><em><font face="Consolas">docker run -d -p 8000:8000 --name sdsweb --restart always sdsweb</font></em></strong></p> <p>The final thing I want to do is to be able to share this image so I’d like to push it up to docker hub</p> <p><strong><em><font face="Consolas">docker login</font></em></strong> - enter username and password <p><strong><em><font face="Consolas">docker push recneps/sdsweb</font></em></strong> <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image001%5B20%5D.png"><img title="clip_image001[20]" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image001[20]" src="http://blogs.recneps.org/image.axd?picture=clip_image001%5B20%5D_thumb.png" width="506" height="121"></a> <p>Then to use it on another machine <p><strong><em><font face="Consolas">docker pull recneps/sdsweb</font></em></strong> <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image002_3.png"><img title="clip_image002" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image002" src="http://blogs.recneps.org/image.axd?picture=clip_image002_thumb_3.png" width="513" height="85"></a> <p>In my next post I am going to look at how I can create a container that can be hosted in Service Fabric</p> http://blogs.recneps.net/post/Custom-ASPNET-MVP-app-running-in-a-Windows-Container http://blogs.recneps.net/post/Custom-ASPNET-MVP-app-running-in-a-Windows-Container#comment http://blogs.recneps.net/post.aspx?id=bebc9b1a-3038-4191-a3eb-64ceea78ace5 Sat, 11 Feb 2017 16:39:36 +0000 ASP.NET PowerShell Visual Studio Windows Containers Docker steve http://blogs.recneps.net/pingback.axd http://blogs.recneps.net/post.aspx?id=bebc9b1a-3038-4191-a3eb-64ceea78ace5 50 http://blogs.recneps.net/trackback.axd?id=bebc9b1a-3038-4191-a3eb-64ceea78ace5 http://blogs.recneps.net/post/Custom-ASPNET-MVP-app-running-in-a-Windows-Container#comment http://blogs.recneps.net/syndication.axd?post=bebc9b1a-3038-4191-a3eb-64ceea78ace5