适用于ASP.NET Core和Visual Studio 2017的docker run命令

编程入门 行业动态 更新时间:2024-10-26 01:31:44
本文介绍了适用于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命令

本文发布于:2023-11-14 02:48:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1586014.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:适用于   命令   NET   Core   Visual

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!