Docker Community Forums

Share and learn in the Docker community.

Docker build fails


(User1989) #1

This is my Dockerfile. I am installling some build tools via chocolatey using docker. Whenever, I try to build the dockerfile, I get this error. Is my dockerfile is not correct?

    # Use the latest Windows Server Core image.
    FROM microsoft/windowsservercore

    ENV chocolateyUseWindowsCompression false

    RUN powershell -Command \
        iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')); \
        choco feature disable --name showDownloadProgress

    RUN choco install visualstudio2015professional
    RUN choco install qtcreator
    RUN choco install curl
    RUN choco install jq
    RUN choco install 7zip.install
    RUN choco install jfrog-cli
    RUN choco install jom

Build command here.................
PS C:\Program Files\Docker> docker build -t test -f Dockerfile.txt .
Sending build context to Docker daemon  54.73MB
Step 1/10 : FROM microsoft/windowsservercore
 ---> 7d89a4baf66c
Step 2/10 : ENV chocolateyUseWindowsCompression false
 ---> Using cache
 ---> 1f4f44275356
Step 3/10 : RUN powershell -Command     iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'));     choco feature disable --name showDownloadProgress
 ---> Running in 6e94d5007856
Exception calling "DownloadString" with "1" argument(s): "Unable to connect to
the remote server"
At line:1 char:1
+ iex ((new-object net.webclient).DownloadString('https://chocolatey.or ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WebException

choco : The term 'choco' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:1 char:88
+ ... .DownloadString('https://chocolatey.org/install.ps1')); choco feature ...
+                                                             ~~~~~
    + CategoryInfo          : ObjectNotFound: (choco:String) [], CommandNotFou
   ndException
    + FullyQualifiedErrorId : CommandNotFoundException

The command 'cmd /S /C powershell -Command     iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'));     choco feature disable --name showDownloadProgress' returned a non-zero code: 1

(Goffinf) #2

Well clearly your build is unable to reach the Chocolatey url for the install script, and because of that Chocolatey isn’t installed so you see the error …

The term ‘choco’ is not recognized as the name of a cmdlet

So you need to look at your connectivity to

https://chocolatey.org/install.ps1

Proxy maybe ?

Fraser.