[docker][Ubuntu] docker loginを実行すると、”error storing credentials”になる。

AIX、UNIX、LinuxContainer
Screenshot_2018-08-11 docker login fails while docker-compose is installed on Ubuntu 18 04 · Issue #6023 · docker compose

はじめに

以下の環境でDocker環境を構築し、docker loginを実行すると、Error saving credentials: error storing credentials - err: exit status 1, out: `Cannot autolaunch D-Bus without X11 $DISPLAY`とエラーが出力されることを確認しました。

$ docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: xxxxx
Password:
Error saving credentials: error storing credentials - err: exit status 1, out: `Cannot autolaunch D-Bus without X11 $DISPLAY`

ちょいと調べてみたので書いておきます。

確認環境:

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
$ docker version
Client:
  Version: 18.06.0-ce
  API version: 1.38
  Go version: go1.10.3
  Git commit: 0ffa825
  Built: Wed Jul 18 19:15:56 2018
  OS/Arch: linux/arm64
  Experimental: false
Server:
  Engine:
    Version: 18.06.0-ce
    API version: 1.38 (minimum version 1.12)
    Go version: go1.10.3
    Git commit: 0ffa825
    Built: Wed Jul 18 19:14:03 2018
    OS/Arch: linux/arm64
    Experimental: false

調査内容

調べてみると、どうやらgolang-docker-credential-helpersの問題のようにも見えます。実際、がっつりGitHubのissueにも同様の書き込みがみられます。

認証情報を扱うkeychain周りのようなコメントが見られます。
その中でも有力な情報としては一番最後のこれかと。

docker login returns "error getting credentials - err: exit status 1 ..." · Issue #60 · docker/docker-credential-helpers
The docker login command is returning the following error for two users out of three users on the same physical host usi...

If you’d like to keep docker-compose on Ubuntu while removing the golang-docker-credential-helpers package, you can apt remove, and then just install the docker-compose binary manually: https://docs.docker.com/compose/install/#install-compose

https://github.com/docker/docker-credential-helpers/issues/60#issuecomment-393300188

どうやらこのコンポーネントは、docker-composeに関連しているものがあるようです。 自分の環境ではどうかというと・・・

$ dpkg -l | grep golang
ii golang-docker-credential-helpers 0.5.0-2 arm64 Use native stores to safeguard Docker credentials

というわけで、ubuntuのレポジトリからパッケージの形でインストールされていました。しかし、dockerから見ると、docker-composeをpipから入れることで、golang-docker-credential-helpersなどの関連するパッケージも最新に近い形で導入されるため、パッケージのものは削除した方が良いようです。

対応方法

というわけで・・・

$ sudo apt purge golang-docker-credential-helpers
$ sudo apt autoremove
$ pip install -U docker-compose
$ docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: xxxxxx
Password:
WARNING! Your password will be stored unencrypted in /home/kometch/.docker/config.json.
Configure a credential helper to remove this warning. See
`https://docs.docker.com/engine/reference/commandline/login/#credentials-store`
Login Succeeded

エラーが出力されずにログイン作業が出来るようになりました。

※このままだと認証情報が暗号化されずに格納されるので、ドキュメントを確認し適切な形で格納できるよう設定を変更してください。

この記事を書いた人

kometchtech

うつ病を患いながら、IT業界の末席にいるおっさんエンジニア。科学計算をしたことがないのに、HPC分野にお邪魔している。興味のある分野で学習したことをblogにまとめつつ、うつ病の経過症状のメモも置いておく日々。じつはRouterboard User Group JPの中の人でもある。 Amazon欲しいものリスト / Arm板を恵んでくれる人募集中

kometchtechをフォローする
タイトルとURLをコピーしました