docker - 如何强制 'docker login'命令忽略现有的凭据帮助程序?

标签 docker credentials

我有一个试图运行docker login命令的系统,它是一个 headless 的linux系统,但是不幸的是,仅安装了Docker Credentials Helper docker-credential-secretservice。

这意味着我收到以下错误:

Error saving credentials: error storing credentials - err: exit status 1, out: `Cannot autolaunch D-Bus without X11 $DISPLAY`

我知道这是有道理的:

By default, Docker looks for the native binary on each of the platforms, i.e. “osxkeychain” on macOS, “wincred” on windows, and “pass” on Linux. A special case is that on Linux, Docker will fall back to the “secretservice” binary if it cannot find the “pass” binary. If none of these binaries are present, it stores the credentials (i.e. password) in base64 encoding in the config files described above.



由于secretservice helper使用GUI凭据存储,因此它尝试打开一个窗口,该窗口无法在 headless 系统上使用。

我无法控制系统,因此无法删除/usr/bin/docker-credential-secretservice文件来强制docker login退回到配置文件,而不是使用secretservice帮助器。

我所能做的就是在用户的主文件夹中创建并列出文件。我试图这样运行命令:
docker --config ./docker login -u <user-name> -p <password> <repository>

我的印象是,登录命令随后将在./docker中创建一个config.json(我注意到docker login将创建该文件夹(如果不存在))。这适用于未安装任何帮助程序的系统,但不适用于有问题的系统。

我也尝试过使用类似以下内容创建~/.docker/config.json:
echo '{"credStore":""}' > ~/.docker/config.json

希望docker login会得到提示,不要在凭证存储中使用任何帮助程序。

非管理员是否有办法强制docker login退回至:

stores the credentials (i.e. password) in base64 encoding in the config files described above. Without deleting the credentials helper?



(作为一个旁注,我当然会要求删除/usr/bin/docker-credential-secretservice,但是,如果不可能或将来不能使用,是否还有其他解决方案?)

最佳答案

不幸的是,Docker(自18.06起)首先查找docker-credential-*二进制文件,如果找到其中的任何二进制文件,它将自动覆盖"credsStore"中的~/.docker/config.json值。

您唯一的解决方法是在主目录中安装docker-credential-pass,以便Docker将使用它代替docker-credential-secretservicedocker-credential-pass不需要GUI。

安装docker-credential-pass的步骤:

docker login fails on a server with no X11 installed

关于docker - 如何强制 'docker login'命令忽略现有的凭据帮助程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55188020/

相关文章:

c# - 从 Web 应用程序中检索原始用户身份

ruby-on-rails - 在 Docker 中运行 Rails 应用程序时 Yarn 包已过时

credentials - Virtuoso Conductor的默认登录凭据

windows - 仅在指定的情况下才要求信用

debugging - 在 Docker 中启用 Wildfly 域模式下的调试 - 端口已在使用中

mysql - 多个服务器上的常量

configuration - Playframework 2 - 存储您的凭据

node.js - W : Failed to fetch http://deb. debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages 404 未找到 [IP : 151. 101.140.204 80]

docker - 无法使用 kubectl 启动容器

Docker 在不同的端口上运行容器