2015-11-17 46 views
7

我已經在Windows 8.1中安裝了Docker Toolbox,並且一直遵循安裝教程。當到達create and push your own imag e的步驟時,我試圖運行docker login ...時出現此錯誤。爲什麼在Docker快速入門終端中「docker登錄」失敗,但是在默認機器中工作?

### VIA Docker Quickstart Terminal 
### docker login --username=myuser --password="mypass" [email protected] 
time="2015-11-17T03:20:58.160803558Z" level=debug msg="Calling POST /v1.21/auth" 
time="2015-11-17T03:20:58.160838971Z" level=info msg="POST /v1.21/auth" 
time="2015-11-17T03:20:58.169033324Z" level=debug msg="hostDir: /etc/docker/certs.d/https:/registry-win-tp3.docker.io/v1" 
time="2015-11-17T03:20:58.169071565Z" level=debug msg="pinging registry endpoint https://registry-win-tp3.docker.io/v1/" 
time="2015-11-17T03:20:58.169084660Z" level=debug msg="attempting v1 ping for registry endpoint https://registry-win-tp3.docker.io/v1/" 
time="2015-11-17T03:20:58.898542338Z" level=debug msg="Error unmarshalling the _ping PingResult: invalid character '<' looking for beginning of value" 
time="2015-11-17T03:20:58.898803841Z" level=debug msg="PingResult.Version: \"\"" 
time="2015-11-17T03:20:58.898818084Z" level=debug msg="Registry standalone header: ''" 
time="2015-11-17T03:20:58.898836197Z" level=debug msg="PingResult.Standalone: true" 
time="2015-11-17T03:20:58.898853685Z" level=debug msg="attempting v1 login to registry endpoint https://registry-win-tp3.docker.io/v1/" 
time="2015-11-17T03:20:59.478756938Z" level=error msg="Handler for POST /v1.21/auth returned error: Unexpected status code [403] : <html><body><h1>403 Forbidden</h1>\nRequest forbidden by administrative rules.\n</body></html>\n\n" 
time="2015-11-17T03:20:59.478815334Z" level=error msg="HTTP Error" err="Unexpected status code [403] : <html><body><h1>403 Forbidden</h1>\nRequest forbidden by administrative rules.\n</body></html>\n\n" statusCode=500 

爲了解決這個問題,我試着從Docker默認虛擬機中運行docker login ...。它在那裏工作!

### VIA default virtual machine (192.168.99.100) 
### docker login --username=myuser --password="mypass" [email protected] https://index.docker.io/v1/ 
time="2015-11-17T03:20:46.053333255Z" level=debug msg="Calling POST /v1.21/auth" 
time="2015-11-17T03:20:46.053404176Z" level=info msg="POST /v1.21/auth" 
time="2015-11-17T03:20:46.082796012Z" level=debug msg="hostDir: /etc/docker/certs.d/https:/index.docker.io/v1" 
time="2015-11-17T03:20:46.082930763Z" level=debug msg="pinging registry endpoint https://index.docker.io/v1/" 
time="2015-11-17T03:20:46.082946790Z" level=debug msg="attempting v1 ping for registry endpoint https://index.docker.io/v1/" 
time="2015-11-17T03:20:46.082959103Z" level=debug msg="attempting v1 login to registry endpoint https://index.docker.io/v1/" 

我注意到他們使用兩個不同的URL,並且第一個遇到解析錯誤。憑據顯然是正確的,因爲他們從VM內部工作,除非這兩個域不共享用戶。網址或響應是否被MINGW64破壞?

+0

似乎有一個解決方法:請參閱我編輯的答案。 – VonC

+0

我已經更新了答案:似乎有一個官方修復。 – VonC

回答

8

更新2016年2月

PR 19891 "Enable cross-platforms login to Registry"應該是固定的問題

使用守護程序定義的註冊網址爲泊塢窗登錄。

這允許Windows客戶端與Linux守護進程進行交互,以正確使用默認的註冊表端點而不是Windows特定的端點。

正是在commit 19eaa71(也許是因爲搬運工1.10?)


這無論是在docker/docker issue 15612docker/docker issue 18019

報道之後的源代碼的一些分析我檢測過我們針對Windows和UNIX有不同的註冊表URL。

在Windows網址來自一個recent PR 15417與評論:

// Currently it is a TEMPORARY link that allows Microsoft to continue 
// development of Docker Engine for Windows. 

因此,有可能該網址不會工作(除非你在最近的Windows Server 2016上)


似乎是在docker/hub-feedback issues 473一種解決方法,其中包括:

  • 指定泊塢窗IO的默認索引註冊表,

    docker login --username=myuser --password=mypassword --email=myemail https://index.docker.io/v1/ 
    WARNING: login credentials saved in C:\Users\myuser\.docker\config.json 
    Login Succeeded 
    
  • 修改由以前創建的config.json文件步驟,以便爲registry-win添加index.docker.io的相同憑據:

config.json

{ 
    "auths": { 
     "https://index.docker.io/v1/": { 
      "auth": "myhash", 
      "email": "myemail" 
     }, 
     "https://registry-win-tp3.docker.io/v1/": { 
      "auth": "myhash", 
      "email": "mydomain"   
     } 
    } 
} 

此後,docker push index.docker.io/myuser/myrepo:latest確實工作。

+0

非常感謝您的全面解答和解決方法!爲我工作很好! – Nejuf

相關問題