はじめに
以下の環境で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周りのようなコメントが見られます。
その中でも有力な情報としては一番最後のこれかと。
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
エラーが出力されずにログイン作業が出来るようになりました。