首页 > 解决方案 > 我可以合并这两个 docker 图像吗?

问题描述

我是 docker 新手,所以这可能是实现这一目标的错误方法。

当我在 Visual Studio 中创建一个新的 .net 项目并说我希望它在 docker 上运行时,它会创建这个 docker 文件。

#Depending on the operating system of the host machines(s) that will build 

or run the containers, the image specified in the FROM statement may need to be changed.
#For more information, please see https://aka.ms/containercompat

FROM microsoft/dotnet:2.1-aspnetcore-runtime-nanoserver-1803 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM microsoft/dotnet:2.1-sdk-nanoserver-1803 AS build
WORKDIR /src
COPY ["WebApplication1/WebApplication1.csproj", "WebApplication1/"]
RUN dotnet restore "WebApplication1/WebApplication1.csproj"
COPY . .
WORKDIR "/src/WebApplication1"
RUN dotnet build "WebApplication1.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "WebApplication1.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "WebApplication1.dll"]

我想在我的应用程序中使用 Azure 表存储,它已经创建了这个图像

microsoft/azure-storage-emulator 作为 tableStorage

我可以添加吗

FROM microsoft/azure-storage-emulator as tableStorage

在同一个 Dockerfile 中并以某种方式在同一个连续图像上使用表存储模拟器?显然他们似乎在组合一堆图像,但我不知道如何组合表格存储图像。

谢谢。

标签: .netdocker

解决方案


推荐阅读