JetBrains Rider 2024.1 Help

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.

Enable the Docker plugin

This functionality relies on the Docker plugin, which is bundled and enabled in JetBrains Rider by default. If the relevant features aren't available, make sure that you didn't disable the plugin.

  1. Press Ctrl+Alt+S to open the IDE settings and then select Plugins.

  2. Open the Installed tab, find the Docker plugin, and select the checkbox next to the plugin name.

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 Add | Dockerfile. In the dialog that opens, choose a container type: Linux or Windows. This will generate Dockerfile with necessary instructions and .dockerignore file as well as a new run configuration.

If 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:

JetBrains Rider: Enable Docker support for a new .NET project

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 Add | Docker Compose File. In the dialog that opens, choose a container type, Linux or Windows. This will generate a 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.

Project 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

Last modified: 15 February 2024