Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Dockerfile Failed on Windows container #427

Closed
soymilkfj opened this issue Jan 25, 2017 · 26 comments

Comments

Projects
None yet
@soymilkfj
Copy link

commented Jan 25, 2017

Hi there,
I am new for Docker on Windows 10.
I try to make my Dockerfile FROM microsoft/windowsservercore but it had some wrong .
Why can't I make new image ?

Expected behavior

  • Make a new image
  • Install some software in container (e.g. python、lazrus ....)

Actual behavior

  • Pull the image microsoft/windowsservercore successfully
  • Failed to build a new image form microsoft/windowsservercore

Information

I use Pwoershell

PS C:\mydockerbuild>docker version
Client:
 Version:      1.13.0
 API version:  1.25
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Wed Jan 18 16:20:26 2017
 OS/Arch:      windows/amd64

Server:
 Version:      1.13.0
 API version:  1.25 (minimum version 1.24)
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Wed Jan 18 16:20:26 2017
 OS/Arch:      windows/amd64
 Experimental: true'
PS C:\mydockerbuild> docker info
Containers: 5
 Running: 0
 Paused: 0
 Stopped: 5
Images: 4
Server Version: 1.13.0
Storage Driver: windowsfilter
 Windows:
Logging Driver: json-file
Plugins:
 Volume: local
 Network: l2bridge l2tunnel nat null overlay transparent
Swarm: inactive
Default Isolation: hyperv
Kernel Version: 10.0 14393 (14393.693.amd64fre.rs1_release.161220-1747)
Operating System: Windows 10 Pro
OSType: windows
Architecture: x86_64
CPUs: 4
Total Memory: 7.482 GiB
Name: claire-PC
ID: CCNQ:ZISQ:IPUR:GETG:LAGY:YOBB:EZ5T:5LR4:45DU:QP4N:5AU6:45JX
Docker Root Dir: C:\ProgramData\Docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: -1
 Goroutines: 18
 System Time: 2017-01-25T11:06:21.9981261+08:00
 EventsListeners: 0
Username: soymilk
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Steps to reproduce the behavior

  1. I use Dockerfile from this
  2. docker build -t="soymilk/python" .
    erroinfo
PS C:\mydockerbuild>  docker build -t="soymilk/eastek" .
Sending build context to Docker daemon  2.56 kB
Step 1/5 : FROM microsoft/windowsservercore
 ---> 4d83c32ad497
Step 2/5 : LABEL Description "Python" Vendor "Python Software Foundation" Version "3.5.1"
 ---> Using cache
 ---> 51914dbdab78
Step 3/5 : RUN powershell.exe -Command     $ErrorActionPreference = 'Stop';     wget https://www.python.org/ftp/python/3.5.1/python-3.5.1.exe -OutFile c:\python-3.5.1.exe ;     Start-Process c:\pyt
hon-3.5.1.exe -ArgumentList '/quiet InstallAllUsers=1 PrependPath=1' -Wait ;     Remove-Item c:\python-3.5.1.exe -Force
 ---> Running in ceee509c9dbb
wget : The remote name could not be resolved: 'www.python.org'
At line:1 char:34
+ ... e = 'Stop'; wget https://www.python.org/ftp/python/3.5.1/python-3.5.1 ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:Htt
   pWebRequest) [Invoke-WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe
   ll.Commands.InvokeWebRequestCommand

The command 'cmd /S /C powershell.exe -Command     $ErrorActionPreference = 'Stop';     wget https://www.python.org/ftp/python/3.5.1/python-3.5.1.exe -OutFile c:\python-3.5.1.exe ;     Start-Proces
s c:\python-3.5.1.exe -ArgumentList '/quiet InstallAllUsers=1 PrependPath=1' -Wait ;     Remove-Item c:\python-3.5.1.exe -Force' returned a non-zero code: 1
@soymilkfj

This comment has been minimized.

Copy link
Author

commented Jan 25, 2017

Sorry for my poor English. Can someone give me some suggestions from my problem?

@friism

This comment has been minimized.

Copy link

commented Jan 25, 2017

It looks like you cannot access https://www.python.org - can you make sure that you have access to that from your container host and that no proxy or similar is getting in the way?

@soymilkfj

This comment has been minimized.

Copy link
Author

commented Jan 25, 2017

@friism Here is my setting
1485316665630

@soymilkfj

This comment has been minimized.

Copy link
Author

commented Jan 25, 2017

I also try into microsoft/windowsservercore container.
(use > docker run -i -t microsoft/windowsservercore powershell.exe)

PS C:\> wget
cmdlet Invoke-WebRequest at command pipeline position 1
Supply values for the following parameters:
Uri: https://www.python.org/ftp/python/3.5.1/python-3.5.1.exe
wget : The remote name could not be resolved: 'www.python.org'
At line:1 char:1
+ wget
+ ~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
PS C:\> wget
cmdlet Invoke-WebRequest at command pipeline position 1
Supply values for the following parameters:
Uri: https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2064%20bits/Lazarus%201.6.2/lazarus-1.6.2-fpc-3.0.0-win64.exe
wget : The remote name could not be resolved: 'sourceforge.net'
At line:1 char:1
+ wget
+ ~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
@friism

This comment has been minimized.

@soymilkfj

This comment has been minimized.

Copy link
Author

commented Jan 25, 2017

@friism
I have ran ./CleanupContainerHostNetworking.ps1 and get a file named "PreCleanupState_MVIWKRDA"

Name                : winnat
RequiredServices    : {Tcpip}
CanPauseAndContinue : False
CanShutdown         : False
CanStop             : True
DisplayName         : Windows NAT Driver
DependentServices   : {}
MachineName         : .
ServiceName         : winnat
ServicesDependedOn  : {Tcpip}
ServiceHandle       : SafeServiceHandle
Status              : Running
ServiceType         : KernelDriver
StartType           : Automatic
Site                : 
Container           : 
Store                            : Local
TcpFilteringBehavior             : AddressDependentFiltering
UdpFilteringBehavior             : AddressDependentFiltering
UdpInboundRefresh                : False
Active                           : True
Caption                          : 
Description                      : 
ElementName                      : 
InstanceID                       : Hddae7244-98b8-4290-9712-76880b83d30e;0
ExternalIPInterfaceAddressPrefix : 
IcmpQueryTimeout                 : 30
InternalIPInterfaceAddressPrefix : 172.25.112.1/20
InternalRoutingDomainId          : {00000000-0000-0000-0000-000000000000}
Name                             : Hddae7244-98b8-4290-9712-76880b83d30e
TcpEstablishedConnectionTimeout  : 1800
TcpTransientConnectionTimeout    : 120
UdpIdleSessionTimeout            : 120
PSComputerName                   : 
CimClass                         : root/StandardCimv2:MSFT_NetNat
CimInstanceProperties            : {Caption, Description, ElementName, InstanceID...}
CimSystemProperties              : Microsoft.Management.Infrastructure.CimSystemProperties
Name                                : nat
Id                                  : ed0692bf-9196-4318-906f-a73070c3f1ad
Notes                               : 
Extensions                          : {Microsoft Windows 篩選平台, Microsoft NDIS Capture}
BandwidthReservationMode            : Absolute
PacketDirectEnabled                 : False
EmbeddedTeamingEnabled              : False
IovEnabled                          : False
SwitchType                          : Internal
AllowManagementOS                   : True
NetAdapterInterfaceDescription      : 
NetAdapterInterfaceDescriptions     : 
IovSupport                          : False
IovSupportReasons                   : 
AvailableIPSecSA                    : 0
NumberIPSecSAAllocated              : 0
AvailableVMQueues                   : 0
NumberVmqAllocated                  : 0
IovQueuePairCount                   : 0
IovQueuePairsInUse                  : 0
IovVirtualFunctionCount             : 0
IovVirtualFunctionsInUse            : 0
PacketDirectInUse                   : False
DefaultQueueVrssEnabledRequested    : True
DefaultQueueVrssEnabled             : False
DefaultQueueVmmqEnabledRequested    : False
DefaultQueueVmmqEnabled             : False
DefaultQueueVmmqQueuePairsRequested : 16
DefaultQueueVmmqQueuePairs          : 0
BandwidthPercentage                 : 0
DefaultFlowMinimumBandwidthAbsolute : 0
DefaultFlowMinimumBandwidthWeight   : 0
CimSession                          : CimSession: .
ComputerName                        : CLAIRE-PC
IsDeleted                           : False

Name                                : DockerNAT
Id                                  : 3471f71b-cc7b-43f5-8850-9b8af135865e
Notes                               : 
Extensions                          : {Microsoft Windows 篩選平台, Microsoft NDIS Capture}
BandwidthReservationMode            : Absolute
PacketDirectEnabled                 : False
EmbeddedTeamingEnabled              : False
IovEnabled                          : False
SwitchType                          : Internal
AllowManagementOS                   : True
NetAdapterInterfaceDescription      : 
NetAdapterInterfaceDescriptions     : 
IovSupport                          : False
IovSupportReasons                   : 
AvailableIPSecSA                    : 0
NumberIPSecSAAllocated              : 0
AvailableVMQueues                   : 0
NumberVmqAllocated                  : 0
IovQueuePairCount                   : 0
IovQueuePairsInUse                  : 0
IovVirtualFunctionCount             : 0
IovVirtualFunctionsInUse            : 0
PacketDirectInUse                   : False
DefaultQueueVrssEnabledRequested    : True
DefaultQueueVrssEnabled             : False
DefaultQueueVmmqEnabledRequested    : False
DefaultQueueVmmqEnabled             : False
DefaultQueueVmmqQueuePairsRequested : 16
DefaultQueueVmmqQueuePairs          : 0
BandwidthPercentage                 : 0
DefaultFlowMinimumBandwidthAbsolute : 0
DefaultFlowMinimumBandwidthWeight   : 0
CimSession                          : CimSession: .
ComputerName                        : CLAIRE-PC
IsDeleted                           : False

@rn rn added the area/wincon label Jan 25, 2017

@friism

This comment has been minimized.

Copy link

commented Jan 26, 2017

@soymilkfj does it work after the clean-up? Checking with @kallie-b to see if she has ideas

@soymilkfj

This comment has been minimized.

Copy link
Author

commented Jan 26, 2017

I create a new network on Hyper-V and change from origin
It still can't wget . :(
But the issues have some different

PS C:\Users\ContainerUser\Desktop> wget

cmdlet Invoke-WebRequest at command pipeline position 1
Supply values for the following parameters:
Uri: https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2064%20bits/Lazarus%201.6.2/lazarus-1.6.2-fpc-3.0.0-win64.exe
wget : The response content cannot be parsed because the Internet Explorer engine is not available, or Internet
Explorer's first-launch configuration is not complete. Specify the UseBasicParsing parameter and try again.
At line:1 char:1
+ wget
+ ~~~~
    + CategoryInfo          : NotImplemented: (:) [Invoke-WebRequest], NotSupportedException
    + FullyQualifiedErrorId : WebCmdletIEDomNotSupportedException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

@rn rn added the version/1.13.0 label Jan 28, 2017

@dgageot dgageot changed the title Make Dockerfile Failed on Windows containaer Make Dockerfile Failed on Windows container Jan 30, 2017

@jelster

This comment has been minimized.

Copy link

commented Jan 30, 2017

@soymilkfj - I think that's good news because it means that wget was able to make the request and receive a response. In your wget command, add -UseBasicParsing and you'll instead get the response content. All things being equal, it might appear your initial issue may have been resolved since you are receiving data from the external endpoint.

"https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2064%20bits/Lazarus%201.6.2/lazarus-1.6.2-fpc-3.0.0-win64.exe
wget : The response content cannot be parsed because the Internet Explorer engine is not available, or Internet
Explorer's first-launch configuration is not complete. Specify the UseBasicParsing parameter and try again"

Hope this helps!

@soymilkfj

This comment has been minimized.

Copy link
Author

commented Feb 2, 2017

@jelster
I used wget -UseBasicParsing and got this message

PS C:\Users\ContainerUser\Desktop> wget -UseBasicParsing

cmdlet Invoke-WebRequest at command pipeline position 1
Supply values for the following parameters:
Uri: https://www.python.org/ftp/python/3.5.1/python-3.5.1.exe


StatusCode        : 200
StatusDescription : OK
Content           : {77, 90, 144, 0...}
RawContent        : HTTP/1.1 200 OK
                    X-Clacks-Overhead: GNU Terry Pratchett
                    Connection: keep-alive
                    X-Served-By: cache-itm7420-ITM
                    X-Cache: HIT
                    X-Cache-Hits: 0
                    X-Timer: S1486013039.802739,VS0,VE0
                    Public-Key-Pins: ma...
Headers           : {[X-Clacks-Overhead, GNU Terry Pratchett], [Connection, keep-alive], [X-Served-By, cache-itm7420-ITM], [X-Cache, HIT]...}
RawContentLength  : 28743504
Content           : {77, 90, 144, 0...}
RawContent        : HTTP/1.1 200 OK
                    X-Clacks-Overhead: GNU Terry Pratchett
                    Connection: keep-alive
                    X-Served-By: cache-itm7420-ITM
                    X-Cache: HIT
                    X-Clacks-Overhead: GNU Terry Pratchett
                    Connection: keep-alive
                    X-Served-By: cache-itm7420-ITM
                    X-Cache: HIT
                    X-Cache-Hits: 0
                    X-Timer: S1486013039.802739,VS0,VE0
                    Public-Key-Pins: ma...
Headers           : {[X-Clacks-Overhead, GNU Terry Pratchett], [Connection, keep-alive], [X-Served-By, cache-itm7420-ITM], [X-Cache, HIT]...}
RawContentLength  : 28743504

Do I download successfully ?
I can't find the file.

@friism

This comment has been minimized.

Copy link

commented Feb 2, 2017

@soymilkfj you want to do:

Invoke-WebRequest https://www.python.org/ftp/python/3.5.1/python-3.5.1.exe -UseBasicParsing -OutFile python-3.5.1.exe
@fcatae

This comment has been minimized.

Copy link

commented Feb 2, 2017

I just ran into this problem in which the name resolution wasn't working properly. 
Solution: I configured daemon.json (at c:\programdata\docker\config) to use the DNS server 8.8.8.8.
The daemon.json parameters are described here:
https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-docker/configure-docker-daemon
Hope it helps.

@kallie-b

This comment has been minimized.

Copy link

commented Feb 3, 2017

Apologies, until now I missed that I was pinged on this thread.

@soymilkfj -- can you update me on where you are now with this issue?

Also when you ran the ./CleanupContainerHostNetworking.ps1 script, did you do so with the -CaptureTraces argument? If you run the script with that argument the script should "hang" and ask you to repro your issue. Then once you've done that, you stop the script by pressing enter. When the script is stopped it will create a "PostCleanupState_XXXXXX" folder long with the "PreCleanupState_XXXXXX" folder.

Once you've done this, you're welcome to send the resulting files to our team and we'll help you troubleshoot this. Just zip the files and send them to: sdn_feedback@microsoft.com

@soymilkfj

This comment has been minimized.

Copy link
Author

commented Feb 3, 2017

@kallie-b OK I will send the e-mail.
@friism I used and got a python-3.5.1.exe

@simonferquel

This comment has been minimized.

Copy link

commented Feb 6, 2017

I suppose the issue is fixed then. Closing the issue (feel free to have a direct followup with @kallie-b)

@akitchin

This comment has been minimized.

Copy link

commented Mar 22, 2017

I believe this is still an issue, I downloaded the Docker Community Edition 17.03.0-ce-win1 (10300) and even though the host was able to download files correctly. I had to go to View Network Connections, vEthernal (HNS Internal Nic) -> Internet Protocol Version 4 -> Properties -> Explicitly set dns to 8.8.8.8. before building an image that includes Wget/

@kallie-b

This comment has been minimized.

Copy link

commented Mar 29, 2017

So, containers that you're creating on Windows 10 don't automatically have access to the internet? Is the symptom of the issue that you wouldn't be able to run something like WebRequest https://www.python.org/ftp/python/3.5.1/python-3.5.1.exe -UseBasicParsing -OutFile python-3.5.1.exe from within a container?

@vargur88

This comment has been minimized.

Copy link

commented Apr 4, 2017

True. The exact issue is still present. Even explicit setting of DNS do not solve the problem.

@jelster

This comment has been minimized.

Copy link

commented Apr 4, 2017

FWIW, using Version 17.04.0-ce-rc2-win6 (10840) running on Win 10 v1607 (build 14393.969) I just ran docker run --rm -ti microsoft/windowsservercore:latest powershell "wget http://google.com -useBasicParsing" with no issues.
Here's the values from running docker network inspect nat:

[
    {
        "Name": "nat",
        "Id": "<snip>",
        "Created": "2017-04-03T13:59:31.5106682-05:00",
        "Scope": "local",
        "Driver": "nat",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "windows",
            "Options": null,
            "Config": [
                {
                    "Subnet": "0.0.0.0/0",
                    "Gateway": "0.0.0.0"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Containers": {},
        "Options": {
            "com.docker.network.windowsshim.hnsid": "<snip>",
            "com.docker.network.windowsshim.networkname": "nat"
        },
        "Labels": {}
    }
]

To make sure it wasn't a fluke, I changed the URL to docker.com; the name was still resolved (though you'll get a request aborted exception since this wget wasn't configured to follow redirects/change protocols to HTTPS).

@vargur88

This comment has been minimized.

Copy link

commented Apr 5, 2017

Thx for assist!
Take a look on my output please:

wget : The remote name could not be resolved: 'google.com'
At line:1 char:1

  • wget http://google.com -useBasicParsing
  •   + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
     eption
      + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
    
    

Update:
My output for docker network inspect nat makes all clear:

"IPAM": {"Driver": "windows",
"Options": null,
"Config": [
{
"Subnet": "172.29.96.0/20",
"Gateway": "172.29.96.1"
}]}

@kallie-b

This comment has been minimized.

Copy link

commented Apr 5, 2017

Let's try recreating your default NAT network.

Stop-Service docker
Get-ContainerNetwork | Remove-ContainerNetwork -Force
Start-Service docker

After running the above commands, could you show us the output of docker network inspect nat again?

@vargur88

This comment has been minimized.

Copy link

commented Apr 6, 2017

Ok, remove operation performed well. Here it is new output:

[
    {
        "Name": "nat",
        "Id": "52bc20069d52c09b5e3f80d0081d147a4572984b3e8876280d69f6787489c97c",
        "Created": "2017-04-06T11:07:46.6376652+03:00",
        "Scope": "local",
        "Driver": "nat",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "windows",
            "Options": null,
            "Config": [
                {
                    "Subnet": "0.0.0.0/0",
                    "Gateway": "0.0.0.0"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Containers": {},
        "Options": {
            "com.docker.network.windowsshim.hnsid": "b398d7ab-1186-4aa0-ae22-89aa7cf280ba",
            "com.docker.network.windowsshim.networkname": "nat"
        },
        "Labels": {}
    }
]

But I still have name resolving issue.

@kallie-b

This comment has been minimized.

Copy link

commented Apr 7, 2017

@vargur88

Can you run ipconfig /all from within the container itself and report the results?

Also, from within the container run ping www.bing.com and nslookup www.bing.com so that we can see exactly which responses you're getting.

@fcatae

This comment has been minimized.

Copy link

commented Apr 12, 2017

I got this fixed in 2 steps:

  1. Configure daemon.json (at c:\programdata\docker\config) to use the DNS server 8.8.8.8.
    The daemon.json parameters are described here:
    https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-docker/configure-docker-daemon

  2. Add this line in Dockerfile:
    RUN Set-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord
    Ref: moby/moby#27499

@robe070

This comment has been minimized.

Copy link

commented Jun 6, 2017

@kallie-b This is issue is still occurring on the latest microsoft/mssql-server-windows image id 7f4a5f7b843c.
The host is Windows Server 2016 with Container support
The issue occurs when the host, a virtual machine, is stopped externally. That is, its not a clean shutdown.
If I run

Stop-Service docker
Get-ContainerNetwork | Remove-ContainerNetwork -Force
Start-Service docker

It fixes it.

When the VM is shutdown from within the VM the network works correctly.

@akalankapagoda

This comment has been minimized.

Copy link

commented Mar 28, 2019

@kallie-b This is issue is still occurring on the latest microsoft/mssql-server-windows image id 7f4a5f7b843c.
The host is Windows Server 2016 with Container support
The issue occurs when the host, a virtual machine, is stopped externally. That is, its not a clean shutdown.
If I run

Stop-Service docker
Get-ContainerNetwork | Remove-ContainerNetwork -Force
Start-Service docker

It fixes it.

When the VM is shutdown from within the VM the network works correctly.

Came here to say that this is still the solution in 2019.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.