for-win icon indicating copy to clipboard operation
for-win copied to clipboard

--squash Fails in ImportLayer

Open vikalyan opened this issue 9 years ago • 7 comments

Expected behavior

Building a dockerfile with the --squash option should succeed when same dockerfile succeeds without --squash option.

Actual behavior

Using --squash fails.

Information

The following error is printed:-

error squashing image: error registering layer: re-exec error: exit status 1: output: time="2017-07-09T06:02:07Z" level=error msg="hcsshim::ImportLayer failed in Win32: The system cannot find the file specified. (0x2) layerId=\\\\?\\C:\\ProgramData\\docker\\windowsfilter\\be16fda5bceb7f630c59d6f23afcb3923a04580f108c9b7e6660d50a101bbdf1 flavour=1 folder=C:\\Windows\\TEMP\\hcs701428691"
hcsshim::ImportLayer failed in Win32: The system cannot find the file specified. (0x2) layerId=\\?\C:\ProgramData\docker\windowsfilter\be16fda5bceb7f630c59d6f23afcb3923a04580f108c9b7e6660d50a101bbdf1 flavour=1 folder=C:\Windows\TEMP\hcs701428691

Output of docker info

Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 14
Server Version: 17.03.1-ee-3
Storage Driver: windowsfilter
 Windows:
Logging Driver: json-file
Plugins:
 Volume: local
 Network: l2bridge l2tunnel nat null overlay transparent
Swarm: inactive
Default Isolation: process
Kernel Version: 10.0 14393 (14393.1358.amd64fre.rs1_release.170602-2252)
Operating System: Windows Server 2016 Datacenter
OSType: windows
Architecture: x86_64
CPUs: 8
Total Memory: 28 GiB
Name: vikalyan-ctr
ID: YTXK:5BUU:KTLL:PIFI:XYCR:7BXE:N6LI:SZLB:HMPW:BRGY:MUQG:75CI
Docker Root Dir: C:\ProgramData\docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: -1
 Goroutines: 21
 System Time: 2017-07-09T06:06:45.793335Z
 EventsListeners: 0
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Output of docker --version

Docker version 17.03.1-ee-3, build 3fcee33

Output of docker images

REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE
<none>                        <none>              a45fc46c5cf5        11 minutes ago      14.3 GB
microsoft/dotnet-framework    3.5                 66759a1de4d0        3 weeks ago         12.5 GB
microsoft/dotnet-framework    4.6.2               015cd665fbdd        3 weeks ago         10.2 GB
microsoft/windowsservercore   latest              015cd665fbdd        3 weeks ago         10.2 GB

Steps to reproduce the behavior

Use the dockerfile contents below:-

FROM microsoft/dotnet-framework:3.5

RUN powershell -ExecutionPolicy Unrestricted -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -Command \
    "Install-WindowsFeature -Name 'NET-Framework-Features' -IncludeAllSubFeature -Verbose" 
	
RUN powershell -ExecutionPolicy Unrestricted -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -Command \
    "Install-WindowsFeature -Name 'WAS-Process-Model' -IncludeAllSubFeature -Verbose"
		
RUN powershell -ExecutionPolicy Unrestricted -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -Command \
    "Install-WindowsFeature -IncludeManagementTools -Name 'Web-WebServer' -IncludeAllSubFeature -Verbose"

RUN powershell -ExecutionPolicy Unrestricted -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -Command \
    "Install-WindowsFeature -Name 'Web-WHC' -IncludeAllSubFeature -Verbose"
	
RUN mkdir C:\Downloads

ADD "https://download.microsoft.com/download/0/6/4/064F84EA-D1DB-4EAA-9A5C-CC2F0FF6A638/vc_redist.x64.exe" "C:/Downloads/vc_redist.x64.exe"
RUN "C:/Downloads/vc_redist.x64.exe /quiet /install /norestart"

ADD "https://download.microsoft.com/download/B/9/F/B9F1AF57-C14A-4670-9973-CDF47209B5BF/dotnet-dev-win-x64.1.0.4.exe" "C:/Downloads"
RUN "C:/Downloads/dotnet-dev-win-x64.1.0.4.exe /install /quiet /norestart"

RUN "rd /S /Q C:\Downloads"

Build the image with the following command:-

docker -D build -f .\Dockerfile -t somename:1.0 --force-rm .

The build will succeed.

Build the image with the following command:-

docker -D build -f .\Dockerfile -t somename:1.0 --force-rm --squash .

The build will fail.

This can also be done without --force-rm. The build will still fail.

Here is the tail of the debug output from the daemon:-

time="2017-07-09T06:23:20.800061800Z" level=debug msg="hcsshim::GetLayerMountPath Flavour 1 ID 8e86a358211f425c067a308cae46aa4f7df49de335045030666f308b9e4ccbc1"
time="2017-07-09T06:23:20.800061800Z" level=debug msg="Calling proc (1)"
time="2017-07-09T06:23:20.800061800Z" level=debug msg="Calling proc (2)"
time="2017-07-09T06:23:20.800061800Z" level=debug msg="hcsshim::GetLayerMountPath succeeded flavour=1 id=8e86a358211f425c067a308cae46aa4f7df49de335045030666f308b9e4ccbc1 path=C:\\ProgramData\\docker\\windowsfilt
er\\8e86a358211f425c067a308cae46aa4f7df49de335045030666f308b9e4ccbc1"
time="2017-07-09T06:23:21.546123900Z" level=debug msg="hcsshim::ExportLayer succeeded flavour=1 layerId=0cbb783235e19eb6e7069c01f5839edd81d5d682373e88d94a2c9efa4b4f879d folder=C:\\Users\\cdpteam\\AppData\\Local\
\Temp\\129\\hcs743988723"
time="2017-07-09T06:23:23.606829500Z" level=debug msg="Cleaning up layer ca0b367adc91ce13bb0974770f7ba5ccb81b42ad9369aee19e3884e9a324a69e: re-exec error: exit status 1: output: time=\"2017-07-09T06:23:23Z\" leve
l=error msg=\"hcsshim::ImportLayer failed in Win32: The system cannot find the file specified. (0x2) layerId=\\\\\\\\?\\\\C:\\\\ProgramData\\\\docker\\\\windowsfilter\\\\ca0b367adc91ce13bb0974770f7ba5ccb81b42ad9
369aee19e3884e9a324a69e flavour=1 folder=C:\\\\Users\\\\cdpteam\\\\AppData\\\\Local\\\\Temp\\\\129\\\\hcs527881163\" \nhcsshim::ImportLayer failed in Win32: The system cannot find the file specified. (0x2) layer
Id=\\\\?\\C:\\ProgramData\\docker\\windowsfilter\\ca0b367adc91ce13bb0974770f7ba5ccb81b42ad9369aee19e3884e9a324a69e flavour=1 folder=C:\\Users\\cdpteam\\AppData\\Local\\Temp\\129\\hcs527881163"
time="2017-07-09T06:23:23.606829500Z" level=debug msg="HCSShim::GetContainers query={}"
time="2017-07-09T06:23:23.609850100Z" level=debug msg="HCSShim::GetContainers succeeded"
time="2017-07-09T06:23:23.610850500Z" level=debug msg="hcsshim::DestroyLayer Flavour 1 ID ca0b367adc91ce13bb0974770f7ba5ccb81b42ad9369aee19e3884e9a324a69e-removing"
time="2017-07-09T06:23:24.388897500Z" level=debug msg="hcsshim::DestroyLayer succeeded flavour=1 id=ca0b367adc91ce13bb0974770f7ba5ccb81b42ad9369aee19e3884e9a324a69e-removing"
time="2017-07-09T06:23:24.389885400Z" level=debug msg="hcsshim::PrepareLayer flavour 1 layerId 0cbb783235e19eb6e7069c01f5839edd81d5d682373e88d94a2c9efa4b4f879d"

@jhowardmsft @darrenstahlmsft

vikalyan avatar Jul 09 '17 06:07 vikalyan

I can't repro on 17.06 on Windows 10 insider build:

PS C:\code\repros\squash-problem> docker build -t foo --squash -f .\Dockerfile .
Sending build context to Docker daemon  4.096kB
Step 1/11 : FROM microsoft/dotnet-framework:3.5
 ---> 66759a1de4d0
Step 2/11 : RUN powershell -ExecutionPolicy Unrestricted -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -Command     "Install-WindowsFeature -Name 'NET-Framework-Features' -IncludeAllSubFeature -Verbose"
 ---> Using cache
 ---> a41c9d853acf
Step 3/11 : RUN powershell -ExecutionPolicy Unrestricted -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -Command     "Install-WindowsFeature -Name 'WAS-Process-Model' -IncludeAllSubFeature -Verbose"
 ---> Running in fae139430fd2
VERBOSE: Installation started...

Success Restart Needed Exit Code      Feature Result
------- -------------- ---------      --------------
True    No             NoChangeNeeded {}
VERBOSE: Installation succeeded.


 ---> 8f2b9c8ecd78
Removing intermediate container fae139430fd2
Step 4/11 : RUN powershell -ExecutionPolicy Unrestricted -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -Command     "Install-WindowsFeature -IncludeManagementTools -Name 'Web-WebServer' -IncludeAllSubFeature -Verbose"
 ---> Running in 74392a4e66ea
VERBOSE: Installation started...
VERBOSE: Continue with installation?
VERBOSE: Prerequisite processing started...
VERBOSE: Prerequisite processing succeeded.

Success Restart Needed Exit Code      Feature Result
------- -------------- ---------      --------------
True    No             Success        {Application Initialization, ASP, ASP....
VERBOSE: Installation succeeded.


 ---> 646d341ae597
Removing intermediate container 74392a4e66ea
Step 5/11 : RUN powershell -ExecutionPolicy Unrestricted -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -Command     "Install-WindowsFeature -Name 'Web-WHC' -IncludeAllSubFeature -Verbose"
 ---> Running in 53b72039016a
VERBOSE: Installation started...
VERBOSE: Continue with installation?
VERBOSE: Prerequisite processing started...
VERBOSE: Prerequisite processing succeeded.

Success Restart Needed Exit Code      Feature Result
------- -------------- ---------      --------------
True    No             Success        {IIS Hostable Web Core}
VERBOSE: Installation succeeded.


 ---> 383c38df3c1c
Removing intermediate container 53b72039016a
Step 6/11 : RUN mkdir C:\Downloads
 ---> Running in dad2802b1d1b
 ---> 098428587f76
Removing intermediate container dad2802b1d1b
Step 7/11 : ADD "https://download.microsoft.com/download/0/6/4/064F84EA-D1DB-4EAA-9A5C-CC2F0FF6A638/vc_redist.x64.exe" "C:/Downloads/vc_redist.x64.exe"
Downloading [==================================================>]  14.99MB/14.99MB
 ---> 3bccb97b43a2
Removing intermediate container 0a3511bd5df0
Step 8/11 : RUN "C:/Downloads/vc_redist.x64.exe /quiet /install /norestart"
 ---> Running in 9e177dfd8488
 ---> 9a17458c3b9d
Removing intermediate container 9e177dfd8488
Step 9/11 : ADD "https://download.microsoft.com/download/B/9/F/B9F1AF57-C14A-4670-9973-CDF47209B5BF/dotnet-dev-win-x64.1.0.4.exe" "C:/Downloads"
Downloading [==================================================>]  106.7MB/106.7MB
 ---> b581f34c324b
Removing intermediate container c6e661d2690e
Step 10/11 : RUN "C:/Downloads/dotnet-dev-win-x64.1.0.4.exe /install /quiet /norestart"
 ---> Running in 44d6464eafcb
 ---> 16a3263700f6
Removing intermediate container 44d6464eafcb
Step 11/11 : RUN "rd /S /Q C:\Downloads"
 ---> Running in e3fbb94c08d4
 ---> b79e23aa6e2b
Removing intermediate container e3fbb94c08d4
Successfully built 85876eed3be9
Successfully tagged foo:latest
PS C:\code\repros\squash-problem>

I wonder if this is a process-isolation thing - do you get it with hyper-v isolation too?

friism avatar Jul 10 '17 23:07 friism

@vikalyan does this repro for you on Windows 10 with hyper-v isolation and/or using Docker 17.06?

friism avatar Jul 11 '17 19:07 friism

@friism

I am using Server 2016. Our production hosts are all Server 2016. I didn't try Windows 10 or Hyper-V isolation. Also, recommended install mechanism for Server 2016 (docker ee) only goes up to 17.03.

vikalyan avatar Jul 12 '17 20:07 vikalyan

I can reproduce with process isolation on WS2016 with 17.06 and with latest master build.

@vikalyan this is really an issue for moby/moby - I recommend re-opening there and pinging @jhowardmsft and @darrenstahlmsft

friism avatar Jul 13 '17 16:07 friism

@friism Will do then!

vikalyan avatar Jul 14 '17 17:07 vikalyan

Closing. Opened https://github.com/moby/moby/issues/34115 on moby/moby.

vikalyan avatar Jul 14 '17 18:07 vikalyan

Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle locked

docker-robott avatar Jun 22 '20 03:06 docker-robott