Robert Bailey 给出的答案适用于某些任务,但可能会遗漏您特别想做的事情。尽管如此,您对他的回答的评论与其说是他回答的错误,不如说是您自己对“失败”的命令实际上意味着什么的理解。
至于你的第二条评论,
使用 docker 我收到以下错误(出于上述原因;我还编辑了问题):Cannot connect to the Docker daemon. Is the docker daemon running on this host?
这是 docker 守护进程未运行的结果。检查它是否通过ps aux | grep docker
. 您可以参考Docker 文档来确定如何正确安装和运行它。
至于你的第一条评论,
使用 curl 我得到:{"errors":[{"code":"DENIED","message":"Failed to read tags for repository '<my_project>/<my_image>'"}]}
. 我必须以某种方式进行身份验证才能访问私有注册表中的图像。我不想使用 docker,因为这意味着我必须有一个可用的 docker 守护进程。我只想查看具有特定版本的容器映像是否在容器注册表中。所以我需要的是 Google Developer Console 中容器注册表的 API。
除非它是公开的,否则您将无法访问curl
该图像,如 Robert 的最新评论中所述,或者除非您在curl
' 调用期间以某种方式提供了一些很棒的 oauth 标头。
您应该使用 gcloud docker 尝试列出注册表中的图像,就像其他 docker 注册表一样。gcloud container
命令组对于您想要的任务来说是错误的。您可以在下面看到命令组的输出gcloud version 96.0.0
(截至此评论的最新) :docker
$ gcloud docker
Usage: docker [OPTIONS] COMMAND [arg...]
docker daemon [ --help | ... ]
docker [ --help | -v | --version ]
A self-sufficient runtime for containers.
Options:
--config=~/.docker Location of client config files
-D, --debug=false Enable debug mode
--disable-legacy-registry=false Do not contact legacy registries
-H, --host=[] Daemon socket(s) to connect to
-h, --help=false Print usage
-l, --log-level=info Set the logging level
--tls=false Use TLS; implied by --tlsverify
--tlscacert=~/.docker/ca.pem Trust certs signed only by this CA
--tlscert=~/.docker/cert.pem Path to TLS certificate file
--tlskey=~/.docker/key.pem Path to TLS key file
--tlsverify=false Use TLS and verify the remote
-v, --version=false Print version information and quit
Commands:
attach Attach to a running container
build Build an image from a Dockerfile
commit Create a new image from a container's changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
diff Inspect changes on a container's filesystem
events Get real time events from the server
exec Run a command in a running container
export Export a container's filesystem as a tar archive
history Show the history of an image
images List images
import Import the contents from a tarball to create a filesystem image
info Display system-wide information
inspect Return low-level information on a container or image
kill Kill a running container
load Load an image from a tar archive or STDIN
login Register or log in to a Docker registry
logout Log out from a Docker registry
logs Fetch the logs of a container
network Manage Docker networks
pause Pause all processes within a container
port List port mappings or a specific mapping for the CONTAINER
ps List containers
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rename Rename a container
restart Restart a container
rm Remove one or more containers
rmi Remove one or more images
run Run a command in a new container
save Save an image(s) to a tar archive
search Search the Docker Hub for images
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop a running container
tag Tag an image into a repository
top Display the running processes of a container
unpause Unpause all processes within a container
version Show the Docker version information
volume Manage Docker volumes
wait Block until a container stops, then print its exit code
Run 'docker COMMAND --help' for more information on a command.
您应该使用gcloud docker search gcr.io/project-id
来检查存储库中的图像。gcloud
拥有您的凭据,因此只要您被认证为项目中的适当用户,它就可以与私有注册表通信。
最后,作为附加资源:Cloud Platform 文档有一整篇关于使用Google Container Registry的文章。