Error saving credentialsでログインできない

Docker outside of Dockerで、Container内でdockerコマンドによりDuckerHubへログインしようとするとError saving credentials: error storing credentialsに…

1
2
3
4
5
$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: <Username>
Password: <Password>
Error saving credentials: error storing credentials - err: exit status 1, out: `Cannot autolaunch D-Bus without X11 $DISPLAY`

gnupg2とpassが必要

Cannot login to Docker account

You only need to install the gnupg2 and pass packages:
sudo apt install gnupg2 pass

インストール後にログインすると

1
2
3
4
5
6
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
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