Docker Community Forums

Share and learn in the Docker community.

Problems building docker image in WS 2016 running inside VmWare WS 14 on Windows 10


(More10) #1

Expected behavior

Exected to build a docker image.

The image builds on the host with Hyper-V enabled.

Actual behavior

Step 2/10 : SHELL powershell.exe -ExecutionPolicy Bypass -Command
hcsshim::ExpandSandboxSize failed in Win32: The file or directory is corrupted and unreadable. (0x570) layerId=923ffc910
1c7bd6b0ae3d392906e181939e929c58dd3da2b92c5b9c939d99e03  size=128849018880

Information

Host

Host is Windows 10 Enterprise with latest updates

PS C:\> [System.Environment]::OSVersion.Version
Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      16299  0

Hyper-V is disabled

VmWare Workstation

VMware® Workstation 14 Pro: 14.1.1 build-7528167,
Virtualize Intel VT-x/EPT checked.
8 GB memory
4 Processors
200 GB disk

Guest

Guest is Windows 2016 with updates from 2018 februari

PS C:\>  [System.Environment]::OSVersion.Version
Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      14393  0
Docker version
PS C:\docker\buildtools> docker --version
Docker version 17.06.2-ee-7, build 925df35
Docker configuration
PS C:\docker\buildtools> type C:\ProgramData\docker\config\daemon.json
{
  "storage-opts": [
    "size=120GB"
  ]
}

Hyper-V is enabled i guest OS.

Dockerfile

Using dockerfile from https://blogs.msdn.microsoft.com/heaths/2017/09/18/installing-build-tools-for-visual-studio-2017-in-a-docker-container/

# Copyright (C) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license. See LICENSE.txt in the project root for license information.
FROM microsoft/windowsservercore:10.0.14393.1715
SHELL ["powershell.exe", "-ExecutionPolicy", "Bypass", "-Command"]

ENV TEST_CONTAINER=1 \
    VS_CHANNEL_URI=https://aka.ms/vs/15/release/799c44140/channel \
    VS_BUILDTOOLS_URI=https://aka.ms/vs/15/release/799c44140/vs_buildtools.exe \
    VS_BUILDTOOLS_SHA256=FA29EB83297AECADB0C4CD41E54512C953164E64EEDD9FB9D3BF9BD70C9A2D29 \
    NUGET_URI=https://dist.nuget.org/win-x86-commandline/v4.1.0/nuget.exe \
    NUGET_SHA256=4C1DE9B026E0C4AB087302FF75240885742C0FAA62BD2554F913BBE1F6CB63A0

# Download nuget.exe
RUN $ErrorActionPreference = 'Stop'; \
    $ProgressPreference = 'SilentlyContinue'; \
    $VerbosePreference = 'Continue'; \
    New-Item -Path C:\bin -Type Directory | Out-Null; \
    [System.Environment]::SetEnvironmentVariable('PATH', "\"${env:PATH};C:\bin\"", 'Machine'); \
    Invoke-WebRequest -Uri $env:NUGET_URI -OutFile C:\bin\nuget.exe; \
    if ((Get-FileHash -Path C:\bin\nuget.exe -Algorithm SHA256).Hash -ne $env:NUGET_SHA256) { throw 'Download hash does not match' }

# Download log collection utility
RUN $ErrorActionPreference = 'Stop'; \
    $ProgressPreference = 'SilentlyContinue'; \
    $VerbosePreference = 'Continue'; \
    Invoke-WebRequest -Uri https://aka.ms/vscollect.exe -OutFile C:\collect.exe

# Download vs_buildtools.exe
RUN $ErrorActionPreference = 'Stop'; \
    $ProgressPreference = 'SilentlyContinue'; \
    $VerbosePreference = 'Continue'; \
    Invoke-WebRequest -Uri $env:VS_BUILDTOOLS_URI -OutFile C:\vs_buildtools.exe; \
    if ((Get-FileHash -Path C:\vs_buildtools.exe -Algorithm SHA256).Hash -ne $env:VS_BUILDTOOLS_SHA256) { throw 'Download hash does not match' }

# Install Visual Studio Build Tools
RUN $ErrorActionPreference = 'Stop'; \
    $VerbosePreference = 'Continue'; \
    $p = Start-Process -Wait -PassThru -FilePath C:\vs_buildtools.exe -ArgumentList '--quiet --nocache --wait --installPath C:\BuildTools'; \
    if ($ret = $p.ExitCode) { c:\collect.exe; throw ('Install failed with exit code 0x{0:x}' -f $ret) }

# Use shell form to start developer command prompt and any other commands specified
SHELL ["cmd.exe", "/s", "/c"]
ENTRYPOINT C:\BuildTools\Common7\Tools\VsDevCmd.bat &&

# Default to PowerShell console running within developer command prompt environment
CMD ["powershell.exe", "-nologo"]

Steps to reproduce the behavior

  1. Install VmWare Worstation pro
  2. Download en_windows_server_2016_updated_feb_2018_x64_dvd_11636692.iso from MSDN
  3. Create and start the VS 2016 in VmWare
  4. Install docker as instructed here: https://blog.docker.com/2017/12/top-5-blogs-of-2017-build-and-run-your-first-docker-windows-server-container/
  5. Create the dockerfile
  6. PS C:\docker\buildtools> docker build -t buildtools2017 .