![](/img/trans.png)
[英]How to integrate Bootstrap 4 in Visual Studio 2017 ASP.NET Core Web Application?
[英]How to run an ASP.NET Core Web Application on Dockers container directly without using Visual Studio
我正在尝试在不使用 Visual Studio 的情况下从 Dockers 容器运行 asp.net 核心 web 应用程序,但它没有运行。 我正在按照Microsoft 网站上本教程中列出的步骤进行操作。
我已经成功地完成了以下所有事情:
Dockers 桌面显示镜像和容器都在运行。
图像(testn)截图:
容器(myapp)截图:
现在,当我在浏览器中打开“http://localhost:8080/”应用程序 url 时,我收到“此页面无法正常工作”消息。见下图:
我的 Dockerfile 代码是:
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "Testn.dll"]
我在 Dockers Desktop 中使用 Lixus 容器。 我的笔记本电脑操作系统是 Windows 10 Home。
我错过了什么?
您的 8080 端口刚刚公开,但未发布亲爱的。 当您要从图像运行容器时,您应该发布您的端口,如下所示: docker run -d -p 8080:8080 testn:latest
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.