Docker compose扩展选项和相对路径
我尝试使用extends选项从另一个docker compose调用docker compose。但是,它似乎不能与相对路径一起正常工作。下面的错误就是我得到的Docker compose扩展选项和相对路径,docker,Docker,我尝试使用extends选项从另一个docker compose调用docker compose。但是,它似乎不能与相对路径一起正常工作。下面的错误就是我得到的 Determining projects to restore... All projects are up-to-date for restore. ../../Interfaces/Proto/Sync/1.0 : warning : directory does not exist. [/src/SyncServer/Sy
Determining projects to restore...
All projects are up-to-date for restore.
../../Interfaces/Proto/Sync/1.0 : warning : directory does not exist. [/src/SyncServer/SyncServer.csproj]
Could not make proto path relative : error : ../../Interfaces/Proto/Sync/1.0/greet.proto: No such file or directory [/src/SyncServer/SyncServer.csproj]
Build FAILED.
../../Interfaces/Proto/Sync/1.0 : warning : directory does not exist. [/src/SyncServer/SyncServer.csproj]
Could not make proto path relative : error : ../../Interfaces/Proto/Sync/1.0/greet.proto: No such file or directory [/src/SyncServer/SyncServer.csproj]
1 Warning(s)
1 Error(s)
Time Elapsed 00:00:01.59
ERROR: Service 'syncserver_mgr' failed to build : The command '/bin/sh -c dotnet build "SyncServer.csproj" -c Release -o /app/build' returned a non-zero code: 1
调用docker compose的一部分,它扩展了另一个docker compose
syncserver_mgr:
extends:
file: C:\QNMS\Sync\docker-compose-sync-without-network-def.yml
service: syncserver
调用docker compose文件(docker compose sync,无网络定义.yml)
称为Dockerfile
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["SyncServer/SyncServer.csproj", "SyncServer/"]
RUN dotnet restore "SyncServer/SyncServer.csproj"
COPY . .
WORKDIR "/src/SyncServer"
RUN dotnet build "SyncServer.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "SyncServer.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "SyncServer.dll"]
RUN apt-get update
RUN apt-get install -y iputils-ping
您正在扩展的撰写文件的版本为
3.x
。仅支持扩展
关键字。这两个文件至少需要是相同的主版本。如果您想特别使用3.4
功能,例如,这两个文件的版本都必须是3.4
。早就扩展了关键字。你应该考虑一下。
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["SyncServer/SyncServer.csproj", "SyncServer/"]
RUN dotnet restore "SyncServer/SyncServer.csproj"
COPY . .
WORKDIR "/src/SyncServer"
RUN dotnet build "SyncServer.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "SyncServer.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "SyncServer.dll"]
RUN apt-get update
RUN apt-get install -y iputils-ping