Public Repository

Last pushed: 8 days ago
Short Description
The official Docker images for .NET Framework on Windows Server 2016 Server Core.
Full Description

Supported tags and respective Dockerfile links

For more information about these images and their history, please see the relevent Dockerfile (microsoft/dotnet-framework-docker). These images are updated via pull requests to the microsoft/dotnet-framework-docker GitHub repo.


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.6.2.

https://docs.microsoft.com/dotnet/articles/framework/

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.

Deploying a .NET Framework 4.x application with Docker

It is easy to create a Docker image for a .NET Framework 4.x application. You can try the instructions below or check out the .NET Framework 4.6.2 Docker sample if you want to try a pre-made version that's ready go.

  1. Build your application in Visual Studio or at the command line.
  2. Add a Dockerfile file with the following content to your project. The Dockerfile assumes that your app is built to the bin\Release directory and that your app name is dotnetapp.exe. Please update your Dockerfile as appropriate.

     FROM microsoft/dotnet-framework:4.6.2
     WORKDIR \app
     COPY bin\Release .
     ENTRYPOINT ["dotnetapp.exe"]
    
  3. 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 dotnetapp
    

The Docker image includes the .NET Framework 4.6.2, however, your application does not need to explicity target the .NET Framework 4.6.2. Applications that target .NET Framework 4.0 or later should work correctly with this image.

Deploying a .NET Framework 3.5 application with Docker

It is easy to create a Docker image for a .NET Framework 3.5 application. You can try the instructions below or check out the .NET Framework 3.5 Docker sample if you want to try a pre-made version that's ready go.

  1. Build your application in Visual Studio or at the command line.
  2. Add a Dockerfile file with the following content to your project. The Dockerfile assumes that your app is built to the bin\Release directory and that your app name is dotnetapp.exe. Please update your Dockerfile as appropriate.

     FROM microsoft/dotnet-framework:3.5
     WORKDIR \app
     COPY bin\Release .
     ENTRYPOINT ["dotnetapp.exe"]
    
  3. 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 dotnetapp
    

The Docker image includes the .NET Framework 3.5, however, your application does not need to explicity target the .NET Framework 3.5. Applications that target .NET Framework 1.0 through 3.5 should work correctly with this image.

Image variants

The microsoft/dotnet-framework images come in different flavors, each designed for a specific use case.

4.6.2

This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of.

This image is for .NET Framework 4.0 and later version applications. It is based on the Windows Server Core image.

3.5

This image is for .NET Framework 3.5 and earlier 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:

You can read more about Windows Containers to learn how to use Docker with Windows.

License

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.

User Feedback

Issues and Contributing

You are invited to report issues or request features by creating a GitHub issue.

Documentation

You can read documentation for using the .NET Framework with Docker usage in the .NET docs. The docs are open source on GitHub. Contributions are welcome!

Docker Pull Command
Owner
microsoft

Comments (7)
kendrahavens
a month ago

@netexplorer I think this same question was posted on GitHub with a suggested fix: https://github.com/Microsoft/dotnet-blog/pull/151

@ashokso The full .NET Framework does not work on any other base OS than windowsservercore. You may be interested in .NET Core. It's APIs are a subset of the full .NET Framework, but it is cross-platform and can run on a debian image. For more info visit the .NET Core image: https://hub.docker.com/r/microsoft/dotnet/

netexplorer
2 months ago

One question about Volume in Dockerfile. We try kinds of formats, such as ".:\app", "[.:/app]", in Dockerfile, but seems it can not work correctly. Error message is : "Unrecognised volume spec: invalid volume specification: '.:\app'". Would you please let us know how to set the Volume of Dockerfile? Thanks a lot!

ashokso
3 months ago

Why is this image this big (9GB) ? Is there a lighter dotnet framework image that is available that just has .net 4.5 and no Windows Server ?

kendrahavens
3 months ago

@gqnelson No, not currently. Visual Studio 2015 and 2017 do have Docker tools that make working with containers much easier. You can read more on the Visual Studio Docker Tools blog post.

gqnelson
6 months ago

Is there an image that comes with visual studio installed so I could do development in a container?

richlander
7 months ago

@alexellis2 Thanks for writing those posts. Much appreciated.

alexellis2
8 months ago

These are great!

I want to share these two posts with the .NET guys -

http://blog.alexellis.io/run-iis-asp-net-on-windows-10-with-docker/

http://blog.alexellis.io/docker-dotnet-containers/

Next step for me is to include a CI element with one of these .NET SDK images with msbuild.