我在GCE中运行了一个GKE集群,我能够构建+标记从ubuntu派生的图像:16.04:
/ # docker images
REPOSITORY TAG IMAGE ID
CREATED SIZE
eu.gcr.io/my-project/ubuntu-gcloud latest a723e43228ae 7 minutes ago 347MB
ubuntu 16.04 ebcd9d4fca80 7 days ago 118MB
首先,我尝试登录注册表(如GKE文档中所述)
docker login -u oauth2accesstoken -p `curl -s "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token" -H "Metadata-Flavor: Google"|awk -F\" "{ print \$4 }"` eu.gcr.io`
然后docker push
命令失败:
# docker push eu.gcr.io/my-project/ubuntu-gcloud
The push refers to a repository [eu.gcr.io/my-project/ubuntu-gcloud]
a3a6893ab23f: Preparing
6e390fa7d62c: Preparing
22b8fccbaf84: Preparing
085eeae7a10b: Preparing
b29983dd2306: Preparing
33f1a94ed7fc: Waiting
b27287a6dbce: Waiting
47c2386f248c: Waiting
2be95f0d8a0c: Waiting
2df9b8def18a: Waiting
denied: Unable to create the repository, please check that you have access to do so.
令牌应该有效,在另一个例子中,我能够gcloud whatever
使用它;该服务帐户具有编辑器'在项目中的角色。
最奇怪的部分是我docker login
凭证明显无效
misko@MacBook ~ $ docker login -u oauth2accesstoken -p somethingverystupidthatisreallynotmypasswordortoken123 eu.gcr.io
Login Succeeded
登录总是成功。
如何成功docker push
到gcr.io?
答案 0 :(得分:1)
试试这个:
gcloud docker -a
如果要使用常规docker命令,请使用GCR凭据更新docker配置:
docker build -t eu.gcr.io/my-project/ubuntu-gcloud .
docker push eu.gcr.io/my-project/ubuntu-gcloud
然后你可以像这样构建和推送泊坞窗图像:
{{1}}