Ubuntu上的Docker .Net Core应用程序无法在localhost:8000中打开

时间:2017-06-16 01:05:42

标签: .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

1 个答案:

答案 0 :(得分:1)

运行docker-compose up时,默认会查找两个文件docker-compose.ymldocker-compose.override.yml。您的repo中的docker-compose.yml未指定任何映射,但主机中的docker-compose.override.yml has a mapping of 5000指向UI容器中的80。不确定你的同事是如何在8080上访问用户界面的,除非他们以不同的方式绘制了一些内容。