zmbq
zmbq

Reputation: 39013

docker run command for ASP.NET Core and Visual Studio 2017

I'm developing an ASP.NET Core application with Visual Studio 2017. I've set up debugging to run the server in a docker container. The container is up and running, but I can't access the database, which is hosted in another docker container.

The database container exposes a port on the host. I need to tell the ASP.NET Core container to map the host's port to an internal port. For this I need to change the docker run command Visual Studio issues to run the container.

Where can I find it so I can change it?

Upvotes: 12

Views: 5872

Answers (2)

aprofessionalpirate
aprofessionalpirate

Reputation: 383

You can add the <DockerfileRunArguments> tag to the <PropertyGroup> section in your *.csproj file and put additional run parameters there.

e.g.

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <DockerfileRunArguments>-p 5000:6000</DockerfileRunArguments>
  </PropertyGroup>
</Project>

Upvotes: 22

Soumen Mukherjee
Soumen Mukherjee

Reputation: 3262

You cannot change the command , however you may create a new Debug Profile and make modifications to the Application Arguments...something like this enter image description here

Upvotes: 4

Related Questions