gpt4 book ai didi

docker "Unable to bind to"

转载 作者:行者123 更新时间:2023-12-02 18:35:40 25 4
gpt4 key购买 nike

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

我尝试了许多端口配置。我尝试导航到 localhost ip 而不是 localhost。我也用谷歌搜索并搜索了更多。

PS C:\Users\jamie\source\repos\Angular\Angular> 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.

另外,这是我的 dockerfile
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

所以尝试绑定(bind) 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"]如果没有,请按照评论链接中的答案进行操作

关于 docker "Unable to bind to",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58105148/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com