我有安装 CoreOS 的虚拟机计算引擎以及里面的图片容器注册表。
我正在遵循这个指示https://cloud.google.com/container-registry/docs/advanced-authentication然后运行
$ docker login -e [email protected] -u oauth2accesstoken -p "$(gcloud auth print-access-token)" https://gcr.io
Flag --email has been deprecated, will be removed in 1.13.
Login Succeeded
$ docker pull gcr.io/myproject/web:v1.0.0
v1.0.0: Pulling from myproject/web
709515475419: Pulling fs layer
943e0887e008: Pulling fs layer
c99fe67ba1a0: Pulling fs layer
2cfe3fdc59a2: Waiting
2c5b377ae620: Waiting
dc0cee14b1bf: Waiting
error pulling image configuration: unauthorized: authentication required
我有尝试检查身份验证
$ docker info
Containers: 10
Running: 0
Paused: 0
Stopped: 10
Images: 2
Server Version: 1.12.6
Storage Driver: overlay
Backing Filesystem: extfs
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: null host bridge overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: seccomp selinux
Kernel Version: 4.9.9-coreos-r1
Operating System: Container Linux by CoreOS 1298.6.0 (Ladybug)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 3.618 GiB
Name: **********************
ID: **********************
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Insecure Registries:
127.0.0.0/8
出了什么问题docker login
,为什么它报告登录成功,但是gcr.io没有出现在docker info
?
答案1
我找到了另一种方法:使用gcloud docker -- pull gcr.io/myproject/web:v1.0.0
因为 gcloud 在容器内运行,所以它找不到 docker。为了解决这个问题,我使用以下命令:
alias gcloud='(docker images google/cloud-sdk || docker pull google/cloud-sdk) > /dev/null;docker run --rm -t -i --net=host -v $HOME/.config:/.config -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker google/cloud-sdk gcloud'