在docker容器中安装cygwin时出错:系统找不到指定的路径。 (0x3)错误= hcsshim :: ImportLayer-在Win32中失败失败 [英] Error installing cygwin in docker container: The system cannot find the path specified. (0x3) error=hcsshim::ImportLayer - failed failed in Win32

查看:280
本文介绍了在docker容器中安装cygwin时出错:系统找不到指定的路径。 (0x3)错误= hcsshim :: ImportLayer-在Win32中失败失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的Dockerfile:

I have a simple Dockerfile:

FROM mcr.microsoft.com/windows:1809

# Install chocolatey
RUN powershell.exe Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

# Install cygwin
RUN choco install -y cygwin --version 3.1.2
RUN refreshenv

CMD [ "powershell" ]

结果是

PS C:\vagrant\delme> docker build . -t localhost/async_windows_service
Sending build context to Docker daemon  2.048kB
Step 1/5 : FROM mcr.microsoft.com/windows:1809
 ---> 2de0138f1799
Step 2/5 : RUN powershell.exe Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
 ---> Using cache
 ---> 7ee59b0c4334
Step 3/5 : RUN choco install -y cygwin --version 3.1.2
 ---> Running in e6c3d1130a4e
Chocolatey v0.10.15
Installing the following packages:
cygwin
By installing you accept licenses for the packages.
Progress: Downloading chocolatey-core.extension 1.3.5.1... 100%
Progress: Downloading Cygwin 3.1.2... 100%

chocolatey-core.extension v1.3.5.1 [Approved]
chocolatey-core.extension package files install completed. Performing other installation steps.
 Installed/updated chocolatey-core extensions.
 The install of chocolatey-core.extension was successful.
  Software installed to 'C:\ProgramData\chocolatey\extensions\chocolatey-core'

Cygwin v3.1.2 [Approved]
cygwin package files install completed. Performing other installation steps.
Download site: http://mirrors.kernel.org/sourceware/cygwin/
Installing 64-bit Cygwin...
Cygwin has been installed.
Added C:\ProgramData\chocolatey\bin\Cygwin.exe shim pointed to 'c:\tools\cygwin\cygwin.bat'.
Copying cygwin package manager (setup) to C:\tools\cygwin
Environment Vars (like PATH) have changed. Close/reopen your shell to
 see the changes (or in powershell/cmd.exe just type `refreshenv`).
 ShimGen has successfully created a shim for setup-x86.exe
 The install of cygwin was successful.
  Software installed to 'C:\tools\cygwin'

Chocolatey installed 2/2 packages.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
re-exec error: exit status 1: output: time="2020-06-02T22:03:52+02:00" level=error msg="hcsshim::ImportLayer - failed failed in Win32: The system cannot find the path specified. (0x3)" error="hcsshim::ImportLayer - failed failed in Win32: The system cannot find the path specified. (0x3)" importFolderPath="C:\\ProgramData\\docker\\tmp\\hcs292836507" path="\\\\?\\C:\\ProgramData\\docker\\windowsfilter\\eeae1d5f886b0b035f4466cf124056f7c1924283548cd960e0024a33d1219984"
hcsshim::ImportLayer - failed failed in Win32: The system cannot find the path specified. (0x3)

我尝试了不同版本的cygwin,还根据建议修改了存储大小,例如此处

I tried different version of cygwin, also modified the storage size, as suggested e.g. here.

这很奇怪。安装似乎可以正常进行,但是docker无法使用 path = \?\\C:\\ProgramData\ \docker\\windowsfilter\\eeae1d5f886b0b035f4466cf124056f7c1924283548cd960e0024a33d1219984

It is strange. The installation seems to go fine but docker cannot find the file (a layer I suppose) with path="\\\\?\\C:\\ProgramData\\docker\\windowsfilter\\eeae1d5f886b0b035f4466cf124056f7c1924283548cd960e0024a33d1219984"

事实上,在我的 C中:\ \ProgramData\docker\windowsfilter 目录,没有以eeae1d开头的文件夹。

And indeed, in my C:\ProgramData\docker\windowsfilter directory, there is no folder starting with eeae1d...

请注意,只有cygwin会引起问题。我可以安装各种其他软件。

Note that only cygwin is causing problems. I can install all kinds of other software.

推荐答案

似乎Cygwin经常使用的硬链接无法正确处理码头工人尤其是当Docker尝试提交映像时,它会失败并显示 hcsshim :: ImportLayer-找不到路径。错误。

It seems that it is hardlinks which Cygwin uses a lot are not handled correctly by Docker. And in particular when Docker tries to commit an image it fails with "hcsshim::ImportLayer - cannot find the path" error.

我最近也遇到了同样的问题,在摆脱Cygwin安装中的硬链接后,我能够毫无问题地提交映像。

I run in the same problem recently and after I got rid of the hardlinks in Cygwin installation I was able to commit the image without problems.

要摆脱我已压缩和解压缩的Cygwin文件夹的硬链接。

To get rid of the hardlinks I have zipped and unzipped Cygwin folder.

这篇关于在docker容器中安装cygwin时出错:系统找不到指定的路径。 (0x3)错误= hcsshim :: ImportLayer-在Win32中失败失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆