问题描述
在ubuntu下进行 docker login时报错:
Error saving credentials: error storing credentials - err: exit status 1, out: `Cannot autolaunch D-Bus without X11 $DISPLAY`
解决方案
方法1
docker-compose version
目前查询到的原因是由于docker-compose
引起,所以可以将docker-compose
卸载即可
sudo apt-get autoremove --purge docker-compose #清理docker-compose
方法2
无须卸载docker-compose
链接
Since this is a bug in the Ubuntu packaging for server it needs to be fixed there but in the meantime a work-around without having to uninstall docker-compose temporarily or having to switch to the docker repos instead you can make it use pass instead. This is what I did:
sudo apt install gnupg2 pass
gpg2 --full-generate-key
This generates a you a gpg2 key, After that's done you can list it with
gpg2 -k
Copy the key id (from the line labelled [uid]) and do
pass init "whatever key id you have"
After that docker login worked fine since it defaults to use pass and only tries to fallback to secretservice if it can't find it. secretservice seems to have an X11 dependency which isn't present on a basic server install.
Side effect is that you get a somewhat more secure credentials store or on your server instead of a base64 encoded json file.
在上面生成key的过程中,一路回车
Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
Your selection?
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (3072)
Requested keysize is 3072 bits
Please specify how long the key should be valid.
0 = key does not expire
<n> = key expires in n days
<n>w = key expires in n weeks
<n>m = key expires in n months
<n>y = key expires in n years
Key is valid for? (0)
Key does not expire at all
Is this correct? (y/N) y
GnuPG needs to construct a user ID to identify your key.
Real name: freshines
Email address:
Comment:
You selected this USER-ID:
"freshines"