Supported Windows Server, version 1709 amd64 tags
Supported Windows Server 2016 amd64 tags
What is the .NET Framework?
The .NET Framework is a general purpose development platform maintained by Microsoft. It is the most popular way to build client and server applications for Windows and Windows Server. It is included with Windows, Windows Server and Windows Server Core. It includes server technologies such as ASP.NET Web Forms, ASP.NET MVC and Windows Communication Framework (WCF) applications, which you can run in Docker containers.
.NET has several capabilities that make development easier, including automatic memory management, (runtime) generic types, reflection, asynchrony, concurrency, and native interop. Millions of developers take advantage of these capabilities to efficiently build high-quality web and client applications.
You can use C#, F# and VB to write .NET Framework apps. C# is simple, powerful, type-safe, and object-oriented while retaining the expressiveness and elegance of C-style languages. F# is a multi-paradigm programming language, enabling both functional and object-oriented patterns and practices. VB is a rapid development programming language with the deepest integration between the language and Visual Studio, providing the fastest path to a working app.
The .NET Framework was first released by Microsoft in 2001. The latest version is .NET Framework 4.7.1.
How to use these Images
These images are based on Windows Containers. You need to be Windows 10 or Windows Server 2016 to use them.
Building a .NET Framework 4.x application with a multi-stage Dockerfile
.NET Framework Docker images can utilize the multi-stage build feature. This feature allows multiple FROM instructions to be used in one Dockerfile. Using this feature, you can build a .NET Framework app using an build image and then copy the published app into a lighter weight runtime image within a single Dockerfile.
Dockerfilefile with the following content to your project. The
Dockerfileand the Docker commands assume that your application is called
dotnetapp.exe. Please update your
FROM microsoft/dotnet-framework-build:4.7.1 AS build-env WORKDIR /app COPY . . RUN msbuild.exe /t:Build /p:Configuration=Release /p:OutputPath=out FROM microsoft/dotnet-framework:4.7.1 WORKDIR /app COPY --from=build-env /app/out ./ ENTRYPOINT ["dotnetapp.exe"]
Type the following Docker commands at the command line, within your project directory (beside Program.cs). You can change the tag name (
dotnetapp) to your own string, as you like.
docker build -t dotnetapp . docker run --rm dotnetapp
The Docker runtime image used in this example includes the .NET Framework 4.7.1, however, your application does not need to explicity target the .NET Framework 4.7.1. Applications that target .NET Framework 4.0 or later should work correctly with this image.
microsoft/dotnet-framework-build images come in different flavors, each designed for a specific use case.
This image is for building .NET Framework 4.x version applications. It is based on the Windows Server Core image.
Related Repos and Examples
See .NET Framework Docker samples to get started with pre-made samples.
See .NET Framework and Docker to learn more about using .NET Framework with Docker.
See the following related repos for other application types:
- microsoft/dotnet-framework for .NET Framework runtime images.
- microsoft/aspnet for ASP.NET Web Forms and MVC images.
- microsoft/dotnet for .NET Core images.
- microsoft/aspnetcore for ASP.NET Core images.
You can read more about Windows Containers to learn how to use Docker with Windows.
The .NET Framework images use the same license as the Windows Server Core base image, as follows:
MICROSOFT SOFTWARE SUPPLEMENTAL LICENSE TERMS
CONTAINER OS IMAGE
Microsoft Corporation (or based on where you live, one of its affiliates) (referenced as “us,” “we,” or “Microsoft”) licenses this Container OS Image supplement to you (“Supplement”). You are licensed to use this Supplement in conjunction with the underlying host operating system software (“Host Software”) solely to assist running the containers feature in the Host Software. The Host Software license terms apply to your use of the Supplement. You may not use it if you do not have a license for the Host Software. You may use this Supplement with each validly licensed copy of the Host Software.
Supported Docker versions
This image is officially supported on Docker version 1.12.2.
Please see Getting Started with Docker for Windows for details on how to install or upgrade Docker to use Windows Containers.
Issues and Contributing
You are invited to report issues or request features by creating a GitHub issue.