Docker 登录:手动登录私有注册表时出错 [英] Docker Login: Error when manually logging into private Registry
问题描述
我无法从 CLI 手动登录我的私人 GitLab Docker 注册表:
I can't manually log into my private GitLab Docker Registry from CLI:
# docker login -u "${DOCKER_USER}" -p "${DOCKER_PASS}" "${DOCKER_URL}"
error getting credentials - err: exit status 1, out: `Cannot autolaunch D-Bus without X11 $DISPLAY`
系统信息:
- Ubuntu 18.04
- docker-ce 18.03.1~ce~3-0~ubuntu(来自官方仓库,无安装脚本)
没有任何用户的 ~/.docker/config.json
并且我正在以 root 身份执行 docker login
.在 Google 上,我只是找到了对 export DISPLAY
的建议... docker 只能在 GUI 环境中登录到远程注册表吗?导出 DISPLAY=0:0 产生:
There is no ~/.docker/config.json
for any users and I'm executing the docker login
as root.
On Google, I just find recommendations to export DISPLAY
... Can docker only login to remote registries in a GUI environment?
Exporting DISPLAY=0:0 yields:
error getting credentials - err: exit status 1, out: `Failed to execute child process "dbus-launch" (No such file or directory)`
我是否缺少一些依赖项?否则 Docker 运行良好,但登录不起作用.我知道有存储凭据的后端,但我不想存储凭据.我只是想对我的注册表进行身份验证以提取图像,这在 Docker ootb 中不起作用吗?
Am I missing some dependency? Docker runs fine otherwise, but login doesn't work. I know there are backends to store credentials, but I don't want to store credentials. I'm just trying to authenticate against my registry to pull an image, doesn't that work in Docker ootb?
推荐答案
docker-compose
包不必要地依赖于损坏的 golang-github-docker-docker-credential-helpers
包.删除可执行文件可以解决此问题.
The docker-compose
package unnecessarily depend on the broken golang-github-docker-docker-credential-helpers
package. Removing the executable fixes this.
rm /usr/bin/docker-credential-secretservice
注意:这是一种解决方法,每次更新包时都需要重复.
Note: This is a workaround and will need to be repeated each time the package is updated.
这会影响 Ubuntu 18.04(可能还有其他非 LTS 版本)和一些 Debian 发布.
This affects the Ubuntu 18.04 (and possibly other non-LTS releases) and some Debian releases.
这篇关于Docker 登录:手动登录私有注册表时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!