To build and run, install the following items:
- .NET Core SDK 2.0 or later
- Docker 17.06 or later
- Git
You can build and run the application locally with the .NET Core 2.0 SDK using the following commands (The instructions assume the root of the repository):
cd aspnetapp
dotnet run
After the application starts, visit http://localhost:5000 in your web browser.
You can build and run the sample in Docker using Linux containers using the following commands (The instructions assume the root of the repository):
cd aspnetapp
docker build -t aspnetapp .
docker run -it --rm -p 5000:80 --name aspnetcore_sample aspnetapp
After the application starts, visit http://localhost:5000 in your web browser.
The
docker run
'-p' argument maps port 5000 on your local machine to port 80 in the container (the port mapping form is host:container). For more information, see the docker run reference on command-line parameters.
The following Docker images are used in this sample
microsoft/aspnetcore-build:2.0
microsoft/aspnetcore:2.0
Reference: https://docs.microsoft.com/en-us/dotnet/core/docker/building-net-docker-images