Skip to content

Building Windows Docker images doesn't work as well as in previous versions #17509

@StefanScherer

Description

@StefanScherer

Description of problem:

Building Windows Docker images doesn't work as well as in previous versions.

docker version:

Client:
 Version:      1.9.0-dev
 API version:  1.22
 Go version:   go1.5.1
 Git commit:   9657062
 Built:        Thu Oct 29 02:23:58 UTC 2015
 OS/Arch:      windows/amd64

Server:
 Version:      1.9.0-dev
 API version:  1.22
 Go version:   go1.5.1
 Git commit:   9657062
 Built:        Thu Oct 29 02:23:58 UTC 2015
 OS/Arch:      windows/amd64

docker info:

PS C:\Windows\system32> docker info
Containers: 45
Images: 235
Server Version: 1.9.0-dev
Storage Driver: windowsfilter
 Windows:
Execution Driver: Windows 1854 1.9.0-dev 9657062
Logging Driver: json-file
Kernel Version: 10.0 10514 (10514.10.amd64fre.th2_release_svc.151006-1500)
Operating System: Windows Server 2016 Technical Preview 3
CPUs: 2
Total Memory: 4 GiB
Name: vagrant-2016
ID: BGZN:GWR2:JUZY:J35M:2KDB:JTE4:L6QA:OHVU:Q4TK:MHG3:BDUW:NNXF
Debug mode (server): true
 File Descriptors: -1
 Goroutines: 17
 System Time: 2015-10-29T22:27:53.2108401+01:00
 EventsListeners: 0
 Init SHA1:
 Init Path: C:\Windows\System32\docker.exe
 Docker Root Dir: C:\ProgramData\docker

uname -a:

MSYS_NT-10.0 vagrant-2016 2.3.0(0.290/5/3) 2015-09-29 10:48 x86_64 Msys

Environment details (AWS, VirtualBox, physical, etc.):
Windows 2016 TP3 Build 10514 with latest Windows updates running in VMware Fusion 7.1.2 on a MacBook Pro El Capitan 10.11.1

How reproducible:

Building a Node.js 4.2.1 Docker image for Windows does not install Node.js with the current nightly build of the Docker Engine for Windows.

Steps to Reproduce:
1.) Take Windows 2016 TP3 with latest Windows Updates and docker installed

2.) Update docker to latest in an admin PowerShell:

stop-service docker
wget https://master.dockerproject.org/windows/amd64/docker.exe -outfile C:\windows\system32\docker.exe
start-service docker

3.) Save the following Dockerfile for Node.js 4.2.1

FROM windowsservercore

ENV NPM_CONFIG_LOGLEVEL info
ENV NODE_VERSION 4.2.1
ENV NODE_SHA256 e460a71ea9aa4d743387a20319042de203de837cb613be0737b6ca368480302d

RUN powershell -Command " \
    wget -Uri https://nodejs.org/dist/v%NODE_VERSION%/node-v%NODE_VERSION%-x64.msi -OutFile node.msi -UseBasicParsing; \
    if ((Get-FileHash node.msi -Algorithm sha256).Hash -ne $env:NODE_SHA256) {exit 1}; \
    msiexec /q /i node.msi | Out-Null; \
    Remove-Item -Path node.msi; \
    wget -Uri https://github.com/StefanScherer/win-patch-iojs/releases/download/1.0.9/patchiojs.exe -OutFile patchiojs.exe -UseBasicParsing; \
    patchiojs.exe 'C:/Program Files/nodejs/node.exe'; \
    Remove-Item -Path patchiojs.exe; \
    "

CMD [ "node" ]

4.) Build the Node.js 4.2.1 Docker image with this Dockerfile

docker build -t node --no-cache .

5.) Check if node is installed by running the interpreter

docker run --rm -ti node node --version

Actual Results:

PS Z:\-vagrant\resources\dockerfiles-windows\node> docker run --rm -ti node node --version
Error response from daemon: Cannot start container 70427d7cb1a3472bf167796af1bc6c3e302f4f8bcd776c1cc4020a0d4791b46d: HCSShim::CreateProcessInComputeSystem - Win32 API call returned error r1=2147942402 err=The system cannot find the file specified. id=70427d7cb1a3472bf167796af1bc6c3e302f4f8bcd776c1cc4020a0d4791b46d params={ node --version  map[NPM_CONFIG_LOGLEVEL:info NODE_VERSION:4.2.1 NODE_SHA256:e460a71ea9aa4d743387a20319042de203de837cb613be0737b6ca368480302d] true [33 98]}

Expected Results:

PS Z:\-vagrant\resources\dockerfiles-windows\node> docker run --rm -ti node node --version
v4.2.1

Additional info:

Everything works fine if I switch back to the first preview release:

stop-service docker
wget -uri https://aka.ms/ContainerTools -OutFile C:\windows\system32\docker.exe
start-service docker

The output of the original docker version:

Client:
 Version:      1.9.0-dev
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   4376380
 Built:        Wed Aug 19 14:59:24 UTC 2015
 OS/Arch:      windows/amd64

Server:
 Version:      1.9.0-dev
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   4376380
 Built:        Wed Aug 19 14:59:24 UTC 2015
 OS/Arch:      windows/amd64

I also tested splitting the long RUN command script into single RUN steps:

FROM windowsservercore

ENV NPM_CONFIG_LOGLEVEL info
ENV NODE_VERSION 4.2.1
ENV NODE_SHA256 e460a71ea9aa4d743387a20319042de203de837cb613be0737b6ca368480302d

RUN powershell -Command "wget -Uri https://nodejs.org/dist/v%NODE_VERSION%/node-v%NODE_VERSION%-x64.msi -OutFile node.msi -UseBasicParsing;"
RUN powershell -Command "if ((Get-FileHash node.msi -Algorithm sha256).Hash -ne $env:NODE_SHA256) {exit 1};"
RUN msiexec /q /i node.msi
RUN powershell -Command "wget -Uri https://github.com/StefanScherer/win-patch-iojs/releases/download/1.0.9/patchiojs.exe -OutFile patchiojs.exe -UseBasicParsing;"
RUN patchiojs.exe 'C:/Program Files/nodejs/node.exe';

CMD [ "node" ]

But then the build fails accessing the just downloaded msi file from one layer to the next layer:

PS Z:\-vagrant\resources\dockerfiles-windows\node> docker build -t node --no-cache 4.2
Sending build context to Docker daemon 10.23 MB
Step 1 : FROM windowsservercore
 ---> 0d53944cb84d
Step 2 : ENV NPM_CONFIG_LOGLEVEL info
 ---> Running in b583f92ec818
 ---> 755467fba49d
Removing intermediate container b583f92ec818
Step 3 : ENV NODE_VERSION 4.2.1
 ---> Running in cd20280545a6
 ---> d6664c6390d5
Removing intermediate container cd20280545a6
Step 4 : ENV NODE_SHA256 e460a71ea9aa4d743387a20319042de203de837cb613be0737b6ca368480302d
 ---> Running in 2995cbb6e4d2
 ---> bfcac0adfa36
Removing intermediate container 2995cbb6e4d2
Step 5 : RUN powershell -Command "wget -Uri https://nodejs.org/dist/v%NODE_VERSION%/node-v%NODE_VERSION%-x64.msi -OutFile node.msi -UseBasicParsing;"
 ---> Running in 206af7b7d3fb
wget -Uri https://nodejs.org/dist/v4.2.1/node-v4.2.1-x64.msi -OutFile node.msi -UseBasicParsing;
 ---> e8de0b78898b
Removing intermediate container 206af7b7d3fb
Step 6 : RUN powershell -Command "if ((Get-FileHash node.msi -Algorithm sha256).Hash -ne $env:NODE_SHA256) {exit 1};"
 ---> Running in aafe3105a161
if ((Get-FileHash node.msi -Algorithm sha256).Hash -ne e460a71ea9aa4d743387a20319042de203de837cb613be0737b6ca368480302d) {exit 1};
 ---> dcd6bb267e76
Removing intermediate container aafe3105a161
Step 7 : RUN msiexec /q /i node.msi
 ---> Running in 6382880f9dfe
This installation package could not be opened.  Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package.
The command 'cmd /S /C msiexec /q /i node.msi' returned a non-zero code: 1619

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions