This repository has been archived by the owner. It is now read-only.
Branch: master
Find file History
Latest commit 74e5ba1 Jun 12, 2017
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
aspnetapp Update samples Jun 12, 2017
README.md Updated aspnet Readme instructions Jan 30, 2017
aspnetapp.sln Add aspnet fx docker sample Jan 14, 2017

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)