.net - Ubuntu 上的 Docker .Net Core 应用程序未在 localhost :8000 中打开

标签 .net bash ubuntu docker docker-compose

我正在使用 Ubuntu 16.04,我在 Windows 上有一个带有 .Net Core 的 docker 应用程序,并试图让它在 Ubuntu 上运行。我有 docker 和 .Net Core 运行没有错误。

当我运行“sudo docker-compose up”时,它会运行服务器并监听“http://+:80”。但我无法在浏览器中打开它。在 Windows 上,我正在使用的每个人都可以在 localhost:8000 上加载它。

当我运行 docker-compose 这就是我得到的:

sudo docker-compose up
Starting webui
Starting projects_api
Starting profile_api
Starting identity_api
Attaching to projects_api, profile_api, webui, identity_api
profile_api     | Hosting environment: Development
profile_api     | Content root path: /app
projects_api    | Hosting environment: Development
profile_api     | Now listening on: http://+:80
projects_api    | Content root path: /app
profile_api     | Application started. Press Ctrl+C to shut down.
projects_api    | Now listening on: http://+:80
projects_api    | Application started. Press Ctrl+C to shut down.
identity_api    | info: Microsoft.Extensions.DependencyInjection.DataProtectionServices[0]
identity_api    |       User profile is available. Using '/root/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
identity_api    | Hosting environment: Development
identity_api    | Content root path: /app
identity_api    | Now listening on: http://+:80
identity_api    | Application started. Press Ctrl+C to shut down.

现在这些是我尝试过的方法,但是,在 Windows 上,他们使用 Powershell 脚本来 ping 服务器。但我不知道如何将 powershell 转换为 bash。我想也许如果我将它转换为 bash,我可以运行该应用程序。这是应该运行服务器的 powershell 脚本:
    param(
    [string]$host_url = "http://localhost"
)


@(
    "$host_url`:5001/api/health/ping",
    "$host_url`:5002/api/health/ping",
    "$host_url`:5003/api/health/ping",
    "$host_url`:5001/.well-known/openid-configuration"
) |
ForEach-Object { Invoke-WebRequest -Uri $_ } |
Select-Object StatusCode, StatusDescription, Content

最佳答案

docker-compose up运行它默认查找两个文件,docker-compose.ymldocker-compose.override.yml . docker-compose.yml在您的仓库中没有指定任何映射,但 docker-compose.override.yml has a mapping of 5000在主机上 80在 UI 容器中。不确定您的同事在 8080 上的 UI 效果如何尽管除非他们映射了不同的东西。

关于.net - Ubuntu 上的 Docker .Net Core 应用程序未在 localhost :8000 中打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44579254/

相关文章:

c# - 如何将一段时间分组为年度? (将时间跨度分成年度)

c# - MongoDB InsertBatch JObject - 序列化错误

c# - SQL Server 2008 的 .NET 异常

c# - wcf 测试客户端不支持此操作,因为它使用 system.threading.tasks.task

bash - 添加到 tar 存档后删除文件

bash 将具有相同第一列的列相加

bash - 解释 bash/pipe 表达式中的最后一个破折号

ruby-on-rails - 没有为测试环境设置 ENV 变量

python - 在 Ubuntu 14.04 中使用 pip 安装 Jupyter Notebook

bash - 使用 sed 过滤列表中的学生