我试图在私有docker注册表上部署带有图像的docker配置。
现在,每次执行docker login registry.example.com
时,都会收到以下错误消息:
error getting credentials - err: exit status 1, out: `Cannot autolaunch D-Bus without X11 $DISPLAY`
我发现非macos用户的唯一解决方案是首先运行export $(dbus-launch)
,但这并没有改变任何东西。
我正在运行Ubuntu Server并尝试使用Ubuntu Docker软件包和Docker-CE软件包。
如何在没有X11会话的情况下登录?
看起来这是因为它默认使用secretservice
可执行文件,由于某种原因,它似乎具有某种X11依赖性。如果您安装和配置pass
docker将使用它而不是似乎解决了问题。
简而言之(来自https://github.com/docker/compose/issues/6023)
sudo apt install gnupg2 pass
gpg2 --full-generate-key
这会生成一个gpg2密钥。完成后,您可以列出它
gpg2 -k
复制密钥ID(从标有[uid]
的行)并执行
pass init "whatever key id you have"
现在docker login
应该工作。
在启动板上记录了几个关于此的错误:
https://bugs.launchpad.net/ubuntu/+source/docker-compose/+bug/1796119
这有效:sudo apt remove golang-docker-credential-helpers
我通过卸载从Ubuntu repo安装的docker-compose
并通过docker-compose
的官方指令安装https://docs.docker.com/compose/install/#install-compose解决了这个问题
secretservice
需要一个GUI。你可以在没有GUI的情况下使用pass
。
不幸的是,Docker的documentation on how to configure Docker Credential Helpers非常缺乏。以下是如何使用Docker配置pass
的全面指南(使用Ubuntu 18.04测试):
pass
docker-credential-pass
找到最新版本的https://github.com/docker/docker-credential-helpers/releases的网址。例如:# substitute with the latest version
url=https://github.com/docker/docker-credential-helpers/releases/download/v0.6.2/docker-credential-pass-v0.6.2-amd64.tar.gz
# download and untar the binary
wget $url
tar -xzvf $(basename $url)
# move the binary to a dir in your $PATH
sudo mv docker-credential-pass /usr/local/bin
# verify it works
docker-credential-pass list
pass
apt install pass
# create a gpg2 key
gpg2 --gen-key
# if you have issues with lack of entropy, "apt install haveged" and try again
# create the password store using the gpg user id above
pass init $gpg_id
docker login
# You should not see any credentials stored in "auths" section.
# "credsStore": "pass" should have been automatically added.
cat ~/.docker/config.json
# verify credentials stored in `pass` store now
pass