Docker login失敗問題的處理
阿新 • • 發佈:2019-03-14
Docker login失敗問題的處理
先是在一臺安裝了docker 18的機器上發現無法登入,報錯為:
Remote error from secret service: org.freedesktop.Secret.Error.IsLocked: Cannot create an item in a locked collection
完整資訊,如下:
docker login registry.cn-hangzhou.aliyuncs.com Username: [email protected] Password: ** Message: 05:55:27.024: Remote error from secret service: org.freedesktop.Secret.Error.IsLocked: Cannot create an item in a locked collection Error saving credentials: error storing credentials - err: exit status 1, out: `Cannot create an item in a locked collection`
開始以為是Aliyun的問題,但是在另一臺機器上是沒問題的,找到了一個方案 :
sudo apt install gnupg2 pass
gpg2 --full-generate-key
# 上面這個命令生成需要一些真隨機條件,所以需要在電腦上多操作(比如亂打鍵盤、亂動滑鼠、亂操作磁碟)。然而因為我是連遠端伺服器,無法操作本地鍵盤和滑鼠,遠端鍵盤和滑鼠好像是沒用的,所以只能另開一個視窗操作磁碟。
# 下面的命令顯示生成的金鑰資訊
gpg2 -k
# 把上面顯示結果中的[uid]後面的部分複製到下面的命令裡
pass init "[uid]內容"
現在登入。
但是,使用下面的方式失敗:
docker login registry.cn-hangzhou.aliyuncs.com
Username: [email protected]
Password:
Error response from daemon: Get https://registry.cn-hangzhou.aliyuncs.com/v2/: unauthorized: authentication required
如果把使用者名稱放到命令列中,就可以了。如下(估計是docker ce的bug):
sudo docker login [email protected] registry.cn-hangzhou.aliyuncs.com
然後,報告是成功的。資訊如下:
sudo docker login [email protected] registry.cn-hangzhou.aliyuncs.com
Password:
WARNING! Your password will be stored unencrypted in /home/supermap/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
進行映象的推送,都是可以的,如下:
docker push registry.cn-hangzhou.aliyuncs.com/openthings/databook
返回資