Docker image is completely borked and won't start

0

I'm running Docker for Windows and trying to build an image. It was working great, but then I added this to the end of my Dockerfile:

# Install Python
RUN choco install -y python3 --params "/InstallDir:C:\Python"
ENV PYTHONPATH=C:\Python\python.exe

When I did that, the image built but when I tried to run it, I got:

C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: container 9e758f7ef343436f64e7e29b795154b1e771a6682b625097d680e3b510a9047c encountered an error during Start: failure in a Windows system call: The compute system exited unexpectedly. (0xc0370106).

So, I removed the two lines and rebuilt. Yet, when I tried to run it (which was now reverted to the version that previously worked!) I still got the error. How can I clear out whatever was messed up? So far, I've tried the following:

  • Restarted Docker
  • Restarted Windows
  • Ran docker rmi -f on the image, and anything that looked like some sort of intermediary build image with no tag.
  • Ran docker system prune
  • Rebuilt the image with a --no-cache
  • Tried giving both the build and run more memory with --memory=8G
  • Cursed various deities

Also, note the image (the complete one, including the lines which install Python) builds and runs on my other machine which is running Windows Server 2016. So, the image is fine. There's something screwed up with this computer that I can't seem to undo. I suppose re-installing Docker is my next step unless anyone has a better idea.

Docker Verison:

Client:
 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        e68fc7a
 Built:             Tue Aug 21 17:21:34 2018
 OS/Arch:           windows/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.1-ce
  API version:      1.38 (minimum version 1.24)
  Go version:       go1.10.3
  Git commit:       e68fc7a
  Built:            Tue Aug 21 17:36:40 2018
  OS/Arch:          windows/amd64
  Experimental:     false

Entire Dockerfile:

# escape=`

FROM microsoft/dotnet-framework:4.7.1 as vsbuild

# Restore the default Windows shell for correct batch processing below.
SHELL ["cmd", "/S", "/C"]

# Download the Build Tools bootstrapper
ADD https://aka.ms/vs/15/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe

# Install Static Analysis Tools
RUN C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
    --add Microsoft.VisualStudio.Component.Static.Analysis.Tools `
 || IF "%ERRORLEVEL%"=="3010" EXIT 0

FROM jetbrains/teamcity-agent:2018.1.2-windowsservercore-ltsc2016

COPY --from=vsbuild ["C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/Team Tools", "C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/Team Tools"]
COPY --from=vsbuild ["C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/MSBuild/Microsoft/VisualStudio/v15.0/CodeAnalysis", "C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/MSBuild/Microsoft/VisualStudio/v15.0/CodeAnalysis"]

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# Install Chocolatey
ADD https://chocolatey.org/install.ps1 C:\TEMP\chocolatey.ps1
RUN C:\TEMP\chocolatey.ps1

# Install Node.js
RUN choco install -y nodejs

# Install Gulp
RUN choco install -y gulp-cli

# Install SQL Command Line Utilities
RUN choco install -y sqlserver-cmdlineutils

# Install Azure Powershell
RUN choco install -y azurepowershell

# Install Web Deploy 3.0
RUN choco install -y msdeploy3

# Install WAWSDeploy
RUN choco install -y wawsdeploy

# Install Python
#RUN choco install -y python3 --params "/InstallDir:C:\Python"
#ENV PYTHONPATH=C:\Python\python.exe
docker
dockerfile
asked on Stack Overflow Sep 13, 2018 by Mike Christensen • edited Sep 13, 2018 by Mike Christensen

1 Answer

0

So, I seemed to have solved it. At least in my case since, as mentioned in the comments, this error is rather generic and doesn't mean one thing in particular.

First, I had to completely comment out everything from my Dockerfile after installing Chocolately on down. This built and also ran. Next, I uncommented one thing at a time. Each time, I'd build and run. Eventually, I'd run into the error (either building or running) and I'd shift some things around and maybe it would work another time. No matter what I tried, I could never get everything to run.

The overall issue, it seems, is that you just can't do that many things in a single Docker build. I believe I was hitting some sort of limit with the number of layers that could be built.

The Solution:

It turns out Chocolately is able to install multiple packages at once. So, I replaced all my RUN commands with a single one:

# Install packages for build
RUN choco install -y nodejs gulp-cli wawsdeploy msdeploy3 azurepowershell sqlserver-cmdlineutils

This resulted in a much faster build and also got rid of the errors. I could probably do the same by running multiple commands with a single RUN statement as well. Suffice to say, it appears this error had to do with building too many layers and running out of resources in some way. Not sure why I didn't have this issue building on Windows Server 2016; perhaps the machine specs were different or there's some other factors at play.

answered on Stack Overflow Sep 13, 2018 by Mike Christensen

User contributions licensed under CC BY-SA 3.0