【发布时间】:2021-11-06 14:53:55
【问题描述】:
我对 gcloud verse docker 的步骤非常迷茫。我有一些构建 docker 镜像的 gradle 代码,我在这样的镜像中看到它
(base) Deans-MacBook-Pro:stockstuff-all dean$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
gcr.io/prod-stock-bot/stockstuff latest b041e2925ee5 27 minutes ago 254MB
我不清楚我是否需要运行 docker push,或者我是否可以直接使用 gcloud run deploy,所以我尝试像这样使用 docker push
(base) Deans-MacBook-Pro:stockstuff-all dean$ docker push gcr.io/prod-stockstuff-bot/stockstuff
Using default tag: latest
The push refers to repository [gcr.io/prod-stockstuff-bot/stockstuff]
An image does not exist locally with the tag: gcr.io/prod-stockstuff-bot/stockstuff
我不知道为什么当我继续列出图像时它说图像在本地不存在。我继续尝试 gcloud run deploy 像这样
(base) Deans-MacBook-Pro:stockstuff-all dean$ gcloud run deploy stockstuff --project prod-stock-bot --region us-west1 --image gcr.io/prod-stockstuff-bot/stockstuff --platform managed
Deploying container to Cloud Run service [stockstuff] in project [prod-stock-bot] region [us-west1]
X Deploying... Image 'gcr.io/prod-stockstuff-bot/stockstuff' not found.
X Creating Revision... Image 'gcr.io/prod-stockstuff-bot/stockstuff' not found.
. Routing traffic...
Deployment failed
ERROR: (gcloud.run.deploy) Image 'gcr.io/prod-stockstuff-bot/stockstuff' not found.
我将这一切作为一个游乐场项目进行,似乎甚至无法启动并运行云运行部署。
我尝试了the spring example,但它甚至没有创建一个 docker 映像,并且无论如何它都失败了
ERROR: (gcloud.run.deploy) Missing required argument [--image]: Requires a container image to deploy (e.g. `gcr.io/cloudrun/hello:latest`) if no build source is provided.
【问题讨论】:
-
您在 GCR 控制台上看到容器了吗? console.cloud.google.com/gcr 可能是您刚刚命名了一个类似该 URL 的容器,并且从未推送到 GCR 存储库。
-
我真的建议你不要使用
latest标签,顺便说一句。有一天它会咬你一口 -
嗨@Dean Hiller,当您在本地系统中列出图像时,我看不到此图像“gcr.io/prod-stockstuff-bot/stockstuff”。使用此名称“gcr.io/prod-stock-bot/stockstuff”标记图像并重新运行 gcloud run 命令。
-
谢谢@Sri,你成功了。我一直想念我有一个错字!!
标签: docker gcloud google-cloud-run