LoginSignup
9

More than 3 years have passed since last update.

【Docker】docker loginをするときにError saving credentials: error storing credentialsがでてログインできないときの話

Posted at

職場でUbuntu 18.10をつかっていたのですが、docker loginをしようとしたところcredentialに関するエラーが出続けて悩みまくっておりましたが、なんとか解決できたのでそのメモ。gitlab registryにもdocker hubにもログインできず死んでおりました。

エラーは

Error saving credentials: error storing credentials - err: exit status 1, out: `The connection is closed`

こんな感じです。
正直connection is closedっていうのが???っていう感じでした。

とりあえずdockerの公式ドキュメントのloginのところをみてみると

Docker公式ドキュメント(英語版)

$HOME/.docker/config.json

ここにdockerはcredentialに関する情報を溜め込んでいるようです。
中身をみてみると、、

"credsStore": "secretservice"

このcredsStoreでは証明書を外部保存する先を指定することができるようです。

公式ドキュメントによると、、、

DEFAULT BEHAVIOR
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. A special case is that on Linux, Docker will fall back to the “secretservice” binary if it cannot find the “pass” binary. If none of these binaries are present, it stores the credentials (i.e. password) in base64 encoding in the config files described above.

Linux上でのみ"pass"がない場合は自動でsecretserviceが指定されるようになっているみたいです。
ここが悪さをしていたようで、↑を消して証明書が外部に保存する機能をなくしてから再度loginすると見事ログインできるようになりました!!

WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

root/.docker/config.json.

ここに証明書情報がセーブされちゃっていて、あまりよろしくないかもですが、、
ひとまず安心です。
Macだったらすごくあっさりとできたので、ubuntuとの違いを感じました、、

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9