码头工人"Unable to bind to"



我已经构建了我的第一个.net core 3.0 docker映像,但是在尝试运行该映像时,docker返回了一些错误。

我已经尝试了许多端口配置。我尝试导航到本地主机 ip 而不是本地主机。我也用谷歌搜索了一下,又用谷歌搜索了一下。

PS C:UsersjamiesourcereposAngularAngular> docker run -it -p 8080:80 angular
warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
Storing keys in a directory '/root/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
No XML encryptor configured. Key {b5292a1f-2d9a-456a-815f-90f19bfe21b1} may be persisted to storage in unencrypted form.
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to bind to http://localhost:5000 on the IPv6 loopback interface: 'Cannot assign requested address'.
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to bind to https://localhost:5001 on the IPv6 loopback interface: 'Cannot assign requested address'.
Hosting environment: Production
Content root path: /app
Now listening on: http://localhost:5000
Now listening on: https://localhost:5001
Application started. Press Ctrl+C to shut down.

另外,这是我的码头工人文件

FROM mcr.microsoft.com/dotnet/core/sdk:3.0
WORKDIR /app
COPY bin/Debug/netcoreapp3.0/publish .
ENTRYPOINT [ "dotnet", "Angular.dll"]

这些只是警告,但我认为应用程序端口的问题,因为服务器运行在不同的位置,如您所见

Now listening on: http://localhost:5000
Now listening on: https://localhost:5001

所以试着绑定50005001

docker run -it -p 8080:5000 angular
or
docker run -it -p 8080:5001 angular

正如大卫提到的,你也需要倾听 尝试添加ENTRYPOINT [ "dotnet", "Angular.dll", "--urls", "http://0.0.0.0:5000"]如果没有,请按照评论中链接中的答案进行操作

相关内容

最新更新