xpost จากhttps://forums.docker.com/t/cannot-connect-to-chocolatey-org/38745
พฤติกรรมที่คาดหวัง
ฉันใช้ Windows Server 2016 Datacenter (ดาวน์โหลด MSDN) 64 บิต - รุ่น 1607 - Build 14393.1715
ฉันใช้ Docker สำหรับ Windows และใช้งาน Windows Containers
ฉันคิดว่านี่เป็นสิ่งที่ง่ายที่สุดในโลกเมื่อต้องการทำสิ่งนี้:
reboot my host machine
docker run -it microsoft/windowsservercore
powershell
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'));
ความคาดหวังสำหรับสิ่งนี้เพื่อติดตั้งช็อคโกแลตในภาชนะ
จริงๆแล้วฉันกำลังจะทำสิ่งนี้ใน dockerfile แต่ฉันจะเป็นตัวอย่างการทำงานขั้นต่ำเพื่อรับความช่วยเหลือตอนนี้
ต่อไปนี้เป็นไฟล์นักเทียบท่าจริงที่ล้มเหลว (มันช่างน่าเศร้าเหลือเกิน)
FROM microsoft/windowsservercore
SHELL ["Powershell"]
ENV ChocolateyUseWindowsCompression false;
RUN iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'));
พฤติกรรมที่แท้จริง
สิ่งแรกก่อน: ฉันกำลังใช้งานอยู่ใน Virtualbox VM ทุกสิ่งทุกอย่างที่ฉันต้องการทำงานทำงานรวมถึง แต่ไม่ จำกัด เฉพาะ: การเชื่อมต่อเครือข่ายภายในและการทดสอบเซิร์ฟเวอร์ sql ที่ทำงานบริการ WCF ที่ทำงานกับสภาพแวดล้อมที่ประกอบด้วยนักเขียนของฉันข้อมูลกลับมาอย่างถูกต้อง ทุกสิ่งที่ฉันคาดหวังว่าระบบจะทำงานได้ นี่เป็นขั้นตอนสุดท้ายที่มีนิ้วข้าม: D ความจริงที่ว่าฉันกำลังใช้งานใน VirtualBox ไม่ควรมีความสำคัญเนื่องจาก Hyper-V ทำงานได้และเครื่องของฉันก็ทำงานได้ตามที่คาดไว้ ฉันแค่คิดว่ามันเป็นมูลค่าการกล่าวขวัญ
docker run -it microsoft/windowsservercore
powershell
PS C:\> iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
Exception calling "DownloadString" with "1" argument(s): "The remote name could not be resolved: 'chocolatey.org'"
At line:1 char:1
+ iex ((new-object net.webclient).DownloadString('https://chocolatey.or ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WebException
PS C:\> ipconfig /all
Windows IP Configuration
   Host Name . . . . . . . . . . . . : 339189e8dd56
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . . . . : attlocal.net
Ethernet adapter vEthernet (Container NIC 6412b757):
   Connection-specific DNS Suffix  . : attlocal.net
   Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #4
   Physical Address. . . . . . . . . : 00-15-5D-80-E9-2C
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::a51b:820e:e45d:fab6%29(Preferred)
   IPv4 Address. . . . . . . . . . . : 172.22.202.147(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . : 172.22.192.1
   DNS Servers . . . . . . . . . . . : 172.22.192.1
                                       10.0.2.2
   NetBIOS over Tcpip. . . . . . . . : Disabled
จากโฮสต์ระบบปฏิบัติการของฉัน (เซิร์ฟเวอร์ 2016) ฉันมีข้อมูลนี้:
PS C:\docker> ipconfig /all
Windows IP Configuration
   Host Name . . . . . . . . . . . . : WIN-CDPNLUMSTOE
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . . . . : attlocal.net
Ethernet adapter vEthernet (HNS Internal NIC) 2:
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #2
   Physical Address. . . . . . . . . : 00-15-5D-80-E5-17
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::5939:52e7:aaf3:5b70%9(Preferred)
   IPv4 Address. . . . . . . . . . . : 172.22.192.1(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :
   DHCPv6 IAID . . . . . . . . . . . : 301995357
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-21-4E-0C-48-08-00-27-51-5F-6A
   DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1
   NetBIOS over Tcpip. . . . . . . . : Enabled
Ethernet adapter vEthernet (HNS Internal NIC) 3:
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #3
   Physical Address. . . . . . . . . : 00-15-5D-B6-45-8D
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::1de4:bff7:36fb:ee92%13(Preferred)
   IPv4 Address. . . . . . . . . . . : 172.23.128.1(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :
   DHCPv6 IAID . . . . . . . . . . . : 570430813
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-21-4E-0C-48-08-00-27-51-5F-6A
   DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1
   NetBIOS over Tcpip. . . . . . . . : Enabled
Ethernet adapter Ethernet:
   Connection-specific DNS Suffix  . : attlocal.net
   Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Desktop Adapter
   Physical Address. . . . . . . . . : 08-00-27-51-5F-6A
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::10de:923b:b866:221d%4(Preferred)
   IPv4 Address. . . . . . . . . . . : 10.0.2.15(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Friday, August 19, 1881 6:47:42 PM
   Lease Expires . . . . . . . . . . : Tuesday, September 26, 2017 11:15:59 PM
   Default Gateway . . . . . . . . . : 10.0.2.2
   DHCP Server . . . . . . . . . . . : 10.0.2.2
   DHCPv6 IAID . . . . . . . . . . . : 50855975
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-21-4E-0C-48-08-00-27-51-5F-6A
   DNS Servers . . . . . . . . . . . : 10.0.2.2
   NetBIOS over Tcpip. . . . . . . . : Enabled
Tunnel adapter isatap.{C420BD56-5715-49BF-9382-5EA99AA48563}:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter #5
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
Tunnel adapter isatap.{70EA4F39-FE0F-4040-B718-ACAC00765808}:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter #6
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
Tunnel adapter isatap.attlocal.net:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : attlocal.net
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter #7
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
PS C:\docker>
ข้อมูล
เอาต์พุต DockerDebugInfo.ps1: https://gist.github.com/jcolebrand/170673e45bf8a659552f22f2071c30d6
ข้อมูลระบบ
ใช้ Windows Server Datacenter (ดาวน์โหลด MSDN) 64 บิต - รุ่น 1607 - Build 14393.1715
PS C:\docker> docker version
Client:
 Version:      17.06.2-ce
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   cec0b72
 Built:        Tue Sep  5 19:57:19 2017
 OS/Arch:      windows/amd64
Server:
 Version:      17.06.2-ce
 API version:  1.30 (minimum version 1.24)
 Go version:   go1.8.3
 Git commit:   cec0b72
 Built:        Tue Sep  5 19:59:47 2017
 OS/Arch:      windows/amd64
 Experimental: true
ถ้าด้วยเหตุผลใดก็ตามที่ถูกทอดทิ้งนี่เป็นสิ่งสำคัญโฮสต์ระบบปฏิบัติการจะต้องเปิดใช้งาน ฉันกำลังทำสิ่งนี้ในสภาพแวดล้อมการพัฒนาแบบ one-shot ดังนั้นไม่ต้องกังวลกับการเปิดใช้งาน VM เพียงอย่างเดียว ฉันไม่สามารถเข้าใจได้ว่าสิ่งนี้สำคัญอย่างไร โดยเฉพาะอย่างยิ่งเนื่องจากทุกอย่าง "ได้ผล"
Stop-Service docker; Get-ContainerNetwork | Remove-ContainerNetwork -Force; Start-Service dockerนำเสนอปัญหาสองสาม ไม่พบบริการที่มีชื่อนักเทียบท่า ไม่พบเครือข่ายคอนเทนเนอร์ด้วย Get-ContainerNetwork
                