Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 344
zmbq Avatar asked Jan 12 '19 23:01

zmbq


People also ask

Can ASP.NET run in Docker?

By default, Docker runs on port 80 with ASP.NET Core, but you can override that. In the example below, the Kestrel server that will run in the container is being configured to listen on port 5000. The other environment variable is simply specifying our environment, which is development in this case.


1 Answers

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>
like image 74
aprofessionalpirate Avatar answered Sep 29 '22 23:09

aprofessionalpirate