Docker tools for .NET projects
JetBrains Rider supports Docker and Docker Compose tools in .NET projects.
When you open a project where Docker or Docker Compose is already configured, you will be able to run and debug your project in Docker right from the IDE. Otherwise, JetBrains Rider will help you quickly generate all necessary settings and configuration files.
Before you start, make sure that Docker is properly configured:
Add Docker support to a .NET project
When you first open a project where Docker support is already set up (there is Dockerfile in the project directory and there is DockerfileFile
project property or there is Docker
profile in the launchSettings.json file), JetBrains Rider will create a Dockerfile run configuration according to project properties. You can then use this configuration to run and debug the project.
To enable Docker support for an existing project, right-click it in the Solution Explorer and choose Dockerfile with necessary instructions and .dockerignore file as well as a new run configuration.
. In the dialog that opens, choose a container type: Linux or Windows. This will generateIf you are creating a new project from scratch, you can enable Docker support in this project right from the start by choosing one of the container types in the Docker Support selector:
Add Docker Compose support to a .NET project
When you first open a solution where Docker Compose support is already set up (there is .dcproj file in the project), JetBrains Rider will create a Docker Compose run configuration according to the project properties.
Note that Docker Compose configuration files (docker-compose.yml, and docker-compose.override.yml) should be in the same directory as .dcproj file. If these configuration files have different names or are located in a different directory, use the DockerComposeBaseFilePath
property in the .dcproj file to specify the correct path. For example:
my-custom-compose
: JetBrains Rider will search for my-custom-compose.yml and my-custom-compose.override.yml files in the project directory;..\my-custom-compose
: JetBrains Rider will search for the same files but in the parent directory.
You can specify additional compose files using the AdditionalComposeFilePaths
property. It is also possible to set up a custom Docker Compose project name with the DockerComposeProjectName
property. To disable the fast mode, set the DockerDevelopmentMode
property to Regular
.
If no Docker Compose support is configured in the project, you can enable it by right-clicking your project in the Solution Explorer and choosing docker-compose.yml file and the corresponding run configuration. If this file already exists, it will be extended by the current project. If the current project doesn't have a Dockerfile, it will be generated too.
. In the dialog that opens, choose a container type, Linux or Windows. This will generate aProject settings for Docker support
When JetBrains Rider generates a Docker run configuration for your project, it will use the solution folder path. You can customize this behavior using the DockerfileContext
property in your project file. There are also several additional project properties that will affect the created run configuration.
Some of MSBuild Container Tools properties in the project file (.csproj):
ContainerDevelopmentMode
DockerfileBuildArguments
DockerfileRunArguments
DockerfileTag
DockerfileContext
ContainerDevelopmentMode
Some of Container Tools launch settings profile (launchSettings.json):
httpPort
sslPort
publishAllPorts
useSSL