适用于ASP.NET Core和Visual Studio 2017的docker run命令 [英] docker run command for ASP.NET Core and Visual Studio 2017

查看:69
本文介绍了适用于ASP.NET Core和Visual Studio 2017的docker run命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio 2017开发ASP.NET Core应用程序.我已设置调试程序以在Docker容器中运行服务器.该容器已启动并正在运行,但是我无法访问该数据库,该数据库位于另一个Docker容器中.

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.

数据库容器公开主机上的端口.我需要告诉ASP.NET Core容器将主机的端口映射到内部端口.为此,我需要更改docker run命令Visual Studio issue来运行容器.

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?

推荐答案

您可以添加< DockerfileRunArguments>标记到< PropertyGroup> * .csproj文件中的部分",然后在其中放置其他运行参数.

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

例如

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

这篇关于适用于ASP.NET Core和Visual Studio 2017的docker run命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆