devcontainers/dotnet
A dev container spec-supported image for working with .NET.
Develop C# and .NET based applications. Includes all needed SDKs, extensions, and dependencies.
| Metadata | Value |
|---|---|
| Categories | Core, Languages |
| Image type | Dockerfile |
| Published images | mcr.microsoft.com/devcontainers/dotnet |
| Available image variants | 9.0 /9.0-bookworm, 9.0-noble, 8.0-noble, 8.0-jammy (full list) |
| Published image architecture(s) | x86-64, arm64/aarch64 for bookworm, bullseye, jammy variants |
| Container host OS support | Linux, macOS, Windows |
| Container OS | Ubuntu (-focal, -jammy), Debian (-bullseye, -bookworm) |
| Languages, platforms | .NET, .NET Core, C# |
See history for information on the contents of published images.
You can directly reference pre-built versions of Dockerfile by using the image property in .devcontainer/devcontainer.json or updating the FROM statement in your own Dockerfile to one of the following. An example Dockerfile is included in this repository.
mcr.microsoft.com/devcontainers/dotnet (latest)mcr.microsoft.com/devcontainers/dotnet:9.0 (or 9.0-bookworm, 9.0-noble to pin to an OS version)mcr.microsoft.com/devcontainers/dotnet:8.0 (or 8.0-bookworm, 8.0-noble, 8.0-focal to pin to an OS version)Refer to this guide for more details.
You can decide how often you want updates by referencing a semantic version of each image. For example:
mcr.microsoft.com/devcontainers/dotnet:1-9.0mcr.microsoft.com/devcontainers/dotnet:1.3-9.0mcr.microsoft.com/devcontainers/dotnet:1.3.0-9.0See history for information on the contents of each version and here for a complete list of available tags.
Alternatively, you can use the contents of .devcontainer to fully customize your container's contents or to build it for a container host architecture not supported by the image.
To enable HTTPS in ASP.NET, you can mount an exported copy of your local dev certificate.
Export it using the following command:
Windows PowerShell
dotnet dev-certs https --trust; dotnet dev-certs https -ep "$env:USERPROFILE/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
macOS/Linux terminal
dotnet dev-certs https --trust; dotnet dev-certs https -ep "${HOME}/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
Add the following in to devcontainer.json:
"remoteEnv": {
"ASPNETCORE_Kestrel__Certificates__Default__Password": "SecurePwdGoesHere",
"ASPNETCORE_Kestrel__Certificates__Default__Path": "/home/vscode/.aspnet/https/aspnetapp.pfx",
}
Finally, make the certificate available in the container as follows:
Add the following to devcontainer.json:
"mounts": [ "source=${env:HOME}${env:USERPROFILE}/.aspnet/https,target=/home/vscode/.aspnet/https,type=bind" ]
Given JavaScript front-end web client code written for use in conjunction with an ASP.NET back-end often requires the use of Node.js-based utilities to build, this container also includes nvm so that you can easily install Node.js.
If you would like to install the Azure CLI, you can reference a dev container feature by adding the following to devcontainer.json:
{
"features": {
"ghcr.io/devcontainers/features/azure-cli:1": {
"version": "latest"
}
}
}
The dev container spec images are maintained in the devcontainers/images repo. You can explore each image and open issues or feature requests.
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. See LICENSE.
No tags have been pushed to this repository yet.