dotnet-framework-docker-sam.../aspnetapp
Rich Lander 74e5ba10e7 Update samples 2017-06-12 07:26:13 -07:00
..
aspnetapp Update samples 2017-06-12 07:26:13 -07:00
README.md Updated aspnet Readme instructions 2017-01-29 20:19:39 -08:00
aspnetapp.sln Add aspnet fx docker sample 2017-01-13 16:29:00 -08:00

README.md

aspnet-framework:4.6.2 Sample

This sample demonstrates how to dockerize an ASP.NET Web Forms app that uses .NET Framework 4.6.2 by adding a Dockerfile to it and running the image with Docker for Windows in a Windows Container. To complete this example you must have Windows 10 Anniversary Edition (or Windows Server 2016) with container support enabled, Docker for Windows (the minimum beta version 1.13), Visual Studio, and Git installed.

Instructions

Note: You must use Windows Containers on Docker for Windows to run this image. Be sure to check that you are properly switched to Windows Containers. Do this by opening the system tray up arrow and right clicking on the Docker whale icon for a popup menu. In the popup menu make sure you select 'Switch to Windows Containers'.

Preparing your Environment

  1. Git clone this repository or otherwise copy this sample to your machine: git clone https://github.com/microsoft/dotnet-framework-docker-samples/aspnetapp
  2. Build the project locally from Visual Studio.

    Note: These instructions are command-line-based for simplicity, but you can also run this sample with Docker Tools for Visual Studio 2017 RC.

Build and run the Docker image:

Note: The base image for this sample is microsoft/iis which uses microsoft/windowsservercore which is a minimal install of Windows Server 2016 and about 4 GB in size. Make sure you have enough space availiable on your drive.

  1. Navigate to the root of your project folder that contains your Dockerfile at the command prompt or terminal.
  2. Build the Docker image: docker build -t aspnetapp .
  3. Run the application in the container: docker run -d -p 80:80 aspnetapp

View your web page running from your container

There is currently a bug that affects how Windows 10 talks to Containers via "NAT" (Network Address Translation). Today you must hit the IP of the container directly. You can get the IP address of your container with the following steps:

  1. Run docker ps and copy the hash of your container ID
  2. Run docker inspect -f "{{ .NetworkSettings.Networks.nat.IPAddress }}" HASH where HASH is replaced with your container ID.
  3. Copy the container ip address and paste into your browser with port 80. (Ex: 172.16.240.197:80)