我正在使用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命令
发布评论