执行“docker-compose up”(Docker for Windows + Windows Container)时出现“奇怪”错误。
Building [name of service] Traceback (most recent call last): File "docker-compose", line 6, in <module>
File "compose\cli\main.py", line 71, in main
File "compose\cli\main.py", line 127, in perform_command
File "compose\cli\main.py", line 1052, in up
File "compose\cli\main.py", line 1048, in up
File "compose\project.py", line 466, in up
File "compose\service.py", line 330, in ensure_image_exists
File "compose\service.py", line 1027, in build
File "site-packages\docker\api\build.py", line 154, in build
File "site-packages\docker\utils\build.py", line 30, in tar
File "site-packages\docker\utils\build.py", line 82, in exclude_paths
File "site-packages\docker\utils\build.py", line 124, in walk
File "site-packages\docker\utils\build.py", line 124, in <genexpr>
File "site-packages\docker\utils\build.py", line 124, in walk
File "site-packages\docker\utils\build.py", line 124, in <genexpr>
File "site-packages\docker\utils\build.py", line 124, in walk
File "site-packages\docker\utils\build.py", line 124, in <genexpr>
File "site-packages\docker\utils\build.py", line 124, in walk
File "site-packages\docker\utils\build.py", line 124, in <genexpr>
File "site-packages\docker\utils\build.py", line 124, in walk
File "site-packages\docker\utils\build.py", line 124, in <genexpr>
File "site-packages\docker\utils\build.py", line 124, in walk
File "site-packages\docker\utils\build.py", line 124, in <genexpr>
File "site-packages\docker\utils\build.py", line 124, in walk
File "site-packages\docker\utils\build.py", line 124, in <genexpr>
File "site-packages\docker\utils\build.py", line 124, in walk
File "site-packages\docker\utils\build.py", line 124, in <genexpr>
File "site-packages\docker\utils\build.py", line 124, in walk
File "site-packages\docker\utils\build.py", line 124, in <genexpr>
File "site-packages\docker\utils\build.py", line 124, in walk
File "site-packages\docker\utils\build.py", line 124, in <genexpr>
File "site-packages\docker\utils\build.py", line 124, in walk
File "site-packages\docker\utils\build.py", line 124, in <genexpr>
File "site-packages\docker\utils\build.py", line 124, in walk
File "site-packages\docker\utils\build.py", line 124, in <genexpr>
File "site-packages\docker\utils\build.py", line 124, in walk
File "site-packages\docker\utils\build.py", line 124, in <genexpr>
File "site-packages\docker\utils\build.py", line 124, in walk
File "site-packages\docker\utils\build.py", line 124, in <genexpr>
File "site-packages\docker\utils\build.py", line 124, in walk
File "site-packages\docker\utils\build.py", line 124, in <genexpr>
File "site-packages\docker\utils\build.py", line 124, in walk
File "site-packages\docker\utils\build.py", line 124, in <genexpr>
File "site-packages\docker\utils\build.py", line 124, in walk
File "site-packages\docker\utils\build.py", line 124, in <genexpr>
File "site-packages\docker\utils\build.py", line 100, in walk
FileNotFoundError: [WinError 3] Das System kann den angegebenen Pfad nicht
finden (translation: The system can't find the specified path): 'D:\\source\\[solution-folder]\\[project-folder]\\node_modules\\npm\\node_modules\\npm-profile\\node_modules\\make-fetch-happen\\node_modules\\http-proxy-agent\\node_modules\\agent-base\\node_modules\\es6-promisify\\node_modules\\es6-promise\\lib\\es6-promise\\promise'
[9028] Failed to execute script docker-compose
搬运工-compose.yml
version: '3'
services:
[service-name]:
image: [image name]
build:
context: [project folder]
dockerfile: Dockerfile
depends_on:
- sql.data
ports:
- "12899:80"
sql.data:
image: microsoft/mssql-server-windows-express
environment:
sa_password: [very strong pwd]
ACCEPT_EULA: "Y"
ports:
- "1433:1433"
Dockerfile
#escape=`
FROM [base_image] AS base
WORKDIR /dist
EXPOSE 80
COPY bin\Release\netcoreapp2.0\publish\ .
USER ContainerAdministrator
RUN npm cache clean --force
RUN npm install
USER ContainerUser
ENTRYPOINT ["dotnet", "[service].dll"]
基本映像(Dockerfile.inst):
#escape=`
FROM microsoft/windowsservercore:1709 as download
RUN @powershell New-Item -itemtype directory -path \"C:\\Program Files\\dotnet\"
# Retrieve and install .NET Core SDK
ENV DOTNET_SDK_VERSION 2.1.104
ENV DOTNET_SDK_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-win-x64.zip
ENV DOTNET_SDK_DOWNLOAD_SHA f3a46570f220cafbdb2f7d40cddd09a8f718b62f02fbea79fdf8e48ac1871a20d2e79191b037a559b7f2bd88064e1ec70d2c68988312a7ee23d34dc757b9981b
RUN @powershell Invoke-WebRequest $Env:DOTNET_SDK_DOWNLOAD_URL -OutFile dotnet.zip; `
if ((Get-FileHash dotnet.zip -Algorithm sha512).Hash -ne $Env:DOTNET_SDK_DOWNLOAD_SHA) { `
Write-Host 'CHECKSUM VERIFICATION FAILED!'; `
exit 1; `
}; `
`
Expand-Archive dotnet.zip -DestinationPath \"C:\\Program Files\\dotnet\"; `
Remove-Item -Force dotnet.zip
FROM stefanscherer/node-windows:nanoserver AS base
RUN mkdir "C:\Program Files\dotnet"
COPY --from=download [ "C:/Program Files/dotnet", "C:/Program Files/dotnet" ]
RUN setx /M PATH "%PATH%;C:\Program Files\dotnet"
RUN setx /M PATH "%PATH%;C:\nodejs"
我做了什么:
所以我相信它已经......与我的docker-compose文件有关?也许你们有个主意!