我为.NET core创建了一个映像:
FROM microsoft/dotnet:2.1-sdk AS build-env
WORKDIR /app
EXPOSE 80 443 5000 5001 5010 5011 7000 22676
#ENTRYPOINT [ "bash"]
CMD ["bash"]
我从中取出一个容器
docker container run -it --publish 5000:8018 --name versie3001 -v //c/tijd/mount:/app michel03
顺利的是我看到了挂载的文件。
dotnet new razor
我和你一起跑
dotnet run
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to bind to https://localhost:5001 on the IPv6 loopback interface: 'Cannot assign requested address'.
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to bind to http://localhost:5000 on the IPv6 loopback interface: 'Cannot assign requested address'.
实际上它说警告,但结果是一样的,当我去localhost:8018 I 没有结果(
ERR_CONNECTION_REFUSED
)
我做错什么了?
我看到一个答案说我应该在我的容器文件中这样做:
ENTRYPOINT [ "dotnet", "watch", "run", "--no-restore", "--urls", "https://0.0.0.0:5000"]
. 它没有给我错误(输出是
Now listening on: https://0.0.0.0:5000
https://localhost:8018
在我的本地机器上。