Skip to content

jzaccone/dotnet-docker-samples

 
 

Repository files navigation

.NET Core Docker Samples

This repo contains samples that demonstrate various .NET Core Docker configurations, which you can use as the basis of your own Docker images. They are also generally useful .NET Core samples and provide instructions for use with and without Docker.

These samples depend on the .NET Core Docker images on Docker Hub, provided by the .NET Team at Microsoft.

Docker uses docker/whalesay as a getting started sample. The .NET Core Team at Microsoft uses dotnetbot, which is the mascot for .NET open source projects. Got something to say? Both whalesay and dotnetbot are great listeners. The dotnetapp-dev, dotnetapp-prod, and dotnetapp-selfcontained samples all simply print a "Welcome!" message to the console. The aspnetapp sample starts a basic ASP.NET Core website running in a container that you can browse to locally.

You can pick the sample that best fits the scenario you are interested in. The instructions for each sample describe how to target Windows or Linux Docker images, from Windows, Linux or macOS.

The samples use .NET Core 2.0. They use Docker multi-stage build and multi-arch tags where appropriate.

You need to have the .NET Core SDK and Git and Docker client 17.06 or newer clients installed to use these samples.

Getting Started

You can run a sample application that runs from a pre-built image that has been published to Docker Hub. The source of this sample application is the dotnetapp-prod sample.

To run the Linux image:

docker run microsoft/dotnet-samples

To run the Windows image:

docker run microsoft/dotnet-samples:dotnetapp-nanoserver

It is recomended to run the sample twice. The second run will not include downloading the image, so is more representative of typical Docker use.

Samples

The following samples show different ways to use .NET Core images.

Development

  • .NET Core Development Sample - This sample is good for development and building since it relies on the .NET Core SDK image. It performs dotnet commands on your behalf, reducing the time it takes to create Docker images (assuming you make changes and then test them in a container, iteratively).

Production

ARM32 / Raspberry Pi

Related Repositories

See the following related Docker Hub repos:

See the following related GitHub repos:

Releases

No releases published

Packages

No packages published

Languages

  • C# 96.5%
  • CSS 3.3%
  • JavaScript 0.2%