我有由Visual Studio 2019创建的dockerfile。我如何手动运行它?下面是dockerfile:
FROM mcr.microsoft.com/dotnet/core/aspnet:2.1-nanoserver-1903 AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:2.1-nanoserver-1903 AS build
WORKDIR /src
COPY ["Client/Client.csproj", "Client/"]
RUN dotnet restore "Client/Client.csproj"
COPY . .
WORKDIR "/src/Client"
RUN dotnet build "Client.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Client.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Client.dll"]
2条答案
按热度按时间de90aj5v1#
在dockerfile所在的文件夹中打开终端并执行:
成功生成后,执行:
我建议您阅读docker build和docker run命令的官方文档。您可以找到可能对您的情况有用的其他标志。
ryhaxcpt2#
精确定位到停靠文件所在的项目文件夹(而不是解决方案)。
在终端中运行以下命令:
船坞建造