Provides docker-compose.yaml to launch a Docker container for .NET Core.
-
Clone this repository to a directory of your choice.
-
Move to the docker-dotnetcore directory.
-
Execute the following command to start the container.
docker-compose up -d
-
Run the following command to confirm that the container has started.
docker-compose ps
Create a .NET Core project using the docker-compose command.
docker-compose run --rm app dotnet new console -o <YourProjectName>
For dotnet new
command options like console, check here or use --help
option to check it.
You can also see other dotnet commands here.
docker-compose run --rm app dotnet new --help
The following command is an example of creating and executing a console application that displays Hello World!
by using docker-compose command.
docker-compose run --rm app dotnet new console -o MyFirstProject
docker-compose run -w /usr/src/MyFirstProject --rm app dotnet run
The -w
option specifies the directory in which to run the command inside the container.
The repository specified by image
in docker-compose.yaml can be changed depending on the usage.
See the links below for more information.
- .NET Core 2.1/3.1
- dotnet/core/sdk: .NET Core SDK
- dotnet/core/aspnet: ASP.NET Core Runtime
- dotnet/core/runtime: .NET Core Runtime
- dotnet/core/runtime-deps: .NET Core Runtime Dependencies
- dotnet/core/samples: .NET Core Samples
- .NET 5.0+
- dotnet/sdk: .NET SDK
- dotnet/aspnet: ASP.NET Core Runtime
- dotnet/runtime: .NET Runtime
- dotnet/runtime-deps: .NET Runtime Dependencies