Skip to main content

Docker login碰到 Error saving credentials: error storing credentials

· 2 min read
Blog owner

嘗試在自己的mac登入某個private的docker registry,帳密都正確但碰到

Error saving credentials: error storing credentials - err: exit status 1, out: `error listing credentials - err: signal: killed, out: ```

把錯誤訊息拿去Google,在stackoverflow看到2017年有人問同樣的問題:docker login - error storing credentials - write permissions error

被標示為正確答案的解法為把config.json幹掉就可以了,config.json的位置預設在~/.docker/config.json,把原本的config.json備份在別處以後,在重新登入一次就work了,而且docker又產生一份config.json

兩份config.json最大的差異在credsStore,舊版用的是"desktop",新版用的是"osxkeychain",config.json內容如下

# 原本config.json
{
"credsStore": "desktop"
}

#再產生的config.json
{
"auths": {
"my_private_registry_domain": {}
},
"credsStore": "osxkeychain"
}

根據官方的說明:

By default, Docker looks for the native binary on each of the platforms, i.e. “osxkeychain” on macOS, “wincred” on windows, and “pass” on Linux.

看來在OSXcredsStore本來就該是"osxkeychain",不知道一開始的"desktop"從哪來的,而且還阻礙login,有空再來查一下。