如何从脚本登录私人Docker注册表? [英] How can I tell if I'm logged in to a private Docker registry from a script?

查看:220
本文介绍了如何从脚本登录私人Docker注册表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何判断我是否从脚本登录到私有Docker注册表服务器?换句话说,已经成功运行了 docker login some.registry.com



注意:我问关于任意的私人注册表,而不是 docker.io 注册表。

解决方案

如果docker登录工作,您将在您的主目录(〜/ .docker / )上找到一个 .docker ,具有 config.json 文件,其中包含凭据。



否则您将收到错误登录。 / p>

注意:docker通过查看注册表名称来确定要使用的凭据:



如果您执行



docker pull myregistry.com/myimage:tag



docker如果您已登录,将会查看,如果没有,请检查您是否具有注册表的凭据 myregistry.com 并使用这些登录名。



如果不是,您将获得权限错误


How can I tell whether or not I'm logged in to a private Docker registry server from a script? In other words, has docker login some.registry.com been run successfully?

Note: I'm asking about an arbitrary private registry, not the docker.io registry.

解决方案

if docker login worked, you will find a .docker folder on your home directory (~/.docker/), with a config.json file with credentials in it.

otherwise you would get an error login in.

Note: docker determine what credentials to use by looking at the registry name:

if you do

docker pull myregistry.com/myimage:tag

docker will look if you're logged in, and if not will check if you have the credentials for the registry myregistry.com and login with those.

If not you will get a permission error

这篇关于如何从脚本登录私人Docker注册表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆