我在一个解决方案中有 3 个项目。
[解决方案]'BuySellApi'(3个项目) | +-- [BuySellApi] | | | +--- BuySellApi.csproj(该项目包含Docker文件) | +-- [BuySellApi.Core] | | | +--- BuySellApi.Core.csproj | +-- [BuySellApi.Data] | +--- BuySellApi.Data.csproj 1. BuySellApi.csproj -> API 2. BuySellApi.Data/BuySellApi.Data.csproj -> 模型 3. BuySellApi.Core/BuySellApi.Core.csproj -> 数据访问
我正在尝试通过在Dockerfile 中指定以下命令来使用 Docker 构建它
FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 5000
ENV ASPNETCORE_URLS=http://+:5000
FROM microsoft/dotnet:2.2-sdk AS build
WORKDIR /src
COPY ["BuySellApi.csproj", "./"]
COPY ["BuySellApi.Data/BuySellApi.Data.csproj", "./"]
COPY ["BuySellApi.Core/BuySellApi.Core.csproj", "./"]
RUN dotnet restore "./BuySellApi.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet …
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个 Dockerfile,将本地 Windows 文件系统上某处的文件夹添加到 Windows 容器中。但是,我很难找出正确的语法。
具体来说,我尝试将目录 [C:\Foo Source Files\Zog Foo\Bar] 的内容复制到 Windows Docker 容器中的 [C:\Bar]。
到目前为止,我已经尝试了以下变体:
ADD ["C:\Foo Source Files\Zog Foo\Bar", "C:/Bar"]
ADD ["C:\Foo Source Files\Zog Foo\Bar\", "C:/Bar/"]
Run Code Online (Sandbox Code Playgroud)
当尝试运行构建映像时,这些导致出现以下错误:
failed to process "[\"C:\\Foo": unexpected end of statement while looking for matching double-quote
Run Code Online (Sandbox Code Playgroud)
相比之下,以下变体...
ADD ["C:/Foo Source Files/Zog Foo/Bar", "C:/Bar"]
ADD ["C:/Foo Source Files/Zog Foo/Bar/", "C:/Bar/"]
ADD ["C:\\Foo Source Files\\Zog Foo\\Bar\\", "C:/Bar/"]
ADD ["C:\\\\Foo Source Files\\\\Zog Foo\\\\Bar\\\\", "C:/Bar/"]
ADD ["C:\\\\Foo Source Files\\\\Zog Foo\\\\Bar", "C:/Bar/"]
ADD C:/Foo Source Files/Zog Foo/Bar/, C:/Bar/ …
Run Code Online (Sandbox Code Playgroud)