1
4
Login
Code
Issues
2
Pull requests
Events
Packages
0a6bb164598af88ded38de8eaba785c70c15901e
0a6bb164598af88ded38de8eaba785c70c15901e

.NET Docker Sample

This sample demonstrates how to build container images for .NET console apps. See .NET Docker Samples for more samples.

Run the sample image

You can start by launching a sample from our container registry.

docker run --rm mcr.microsoft.com/dotnet/samples:dotnetapp-chiseled

Build the image

You can build and run an image using the following instructions (cloninig the repo isn't necessary):

docker build --pull -t dotnetapp 'https://github.com/dotnet/dotnet-docker.git#:samples/dotnetapp'
docker run --rm dotnetapp

Add the argument -f <Dockerfile> to build the sample in a different configuration. For example, build an Ubuntu Chiseled image using Dockerfile.chiseled:

docker build --pull -t dotnetapp -f Dockerfile.chiseled 'https://github.com/dotnet/dotnet-docker.git#:samples/dotnetapp'

Supported Linux distros

The .NET Team publishes images for multiple distros.

Samples are provided for:

Supported Windows versions

The .NET Team publishes images for multiple Windows versions. You must have Windows containers enabled to use these images.

Samples are provided for

Windows variants of the sample can be pulled via one the following image names:

  • mcr.microsoft.com/dotnet/samples:dotnetapp-nanoserver-1809
  • mcr.microsoft.com/dotnet/samples:dotnetapp-nanoserver-ltsc2022