我正在尝试在私有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会话的情况下登录?
答案 0 :(得分:13)
看起来像是因为它默认使用secretservice
可执行文件,由于某种原因,该可执行文件似乎具有某种X11依赖性。如果您安装并配置pass
,则docker将使用它来解决问题。
简而言之(来自https://github.com/docker/compose/issues/6023)
sudo apt install gnupg2 pass
gpg2 --full-generate-key
这将为您生成一个gpg2密钥。完成后,您可以使用
将其列出gpg2 -k
(从标记为[uid]
的行中复制密钥ID,然后执行
pass init "whatever key id you have"
现在docker login
应该可以工作了。
与启动板有关的一些错误记录如下:
https://bugs.launchpad.net/ubuntu/+source/docker-compose/+bug/1796119
答案 1 :(得分:10)
您可以删除有问题的软件包golang-docker-credential-helpers
,而无需删除所有docker-compose
。
以下内容在未安装X11的服务器上对我有用:
dpkg -r --ignore-depends=golang-docker-credential-helpers golang-docker-credential-helpers
然后
echo 'foo' | docker login mydockerrepo.com -u dockeruser --password-stdin
来源:
Debian中报告的 bug:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=910823#39
在ubuntu上报告的错误:
https://bugs.launchpad.net/ubuntu/+source/docker-compose/+bug/1796119
答案 2 :(得分:4)
这有效:sudo apt remove golang-docker-credential-helpers
答案 3 :(得分:1)
在Ubuntu 18.04上对我有帮助的是:
sudo apt-get install docker
重新安装docker sudo docker login
重新登录答案 4 :(得分:0)
我已解决此问题,方法是卸载从Ubuntu存储库安装的docker-compose
,并根据https://docs.docker.com/compose/install/#install-compose上的官方说明安装docker-compose
答案 5 :(得分:0)
secretservice
需要一个GUI。您可以在没有GUI的情况下使用pass
。
不幸的是,非常缺乏Docker的documentation on how to configure Docker Credential Helpers。这是全面的指南,说明如何使用Docker配置pass
(已在Ubuntu 18.04上测试):
pass
docker-credential-pass
的URL。例如:# 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
答案 6 :(得分:0)
比已经发布的答案容易得多,我在https://github.com/docker/docker-credential-helpers/issues/105的评论中找到了答案。
解决方案是重命名docker-credential-secretservice
例如:mv /usr/bin/docker-credential-secretservice /usr/bin/docker-credential-secretservice.broken
执行此操作后,无论是否安装了docker-compose,docker登录都将起作用。无需添加或删除其他软件包。