You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

指定--tag时需Dockerfile,gcloud builds submit报错如何解决?

解决gcloud builds submit报错的方案

当执行命令时出现ERROR: (gcloud.builds.submit) Invalid value for [source]: Dockerfile required when specifying --tag错误,即使当前目录存在Dockerfile,可通过以下方式修改命令实现成功构建:

  • 显式指定构建上下文为当前目录,让命令明确识别Dockerfile所在路径:
    gcloud builds submit --tag gcr.io/hello-python-app/helloyoutube .
    
  • 若需要更精准控制,也可以显式指定Dockerfile的位置:
    gcloud builds submit --tag gcr.io/hello-python-app/helloyoutube --dockerfile=Dockerfile .
    

报错原因

gcloud builds submit命令需要明确构建上下文(即包含Dockerfile及相关构建文件的目录),原命令未指定构建上下文路径,导致命令无法定位到当前目录下的Dockerfile,从而抛出错误。添加.表示以当前目录作为构建上下文,命令会自动在该目录下查找Dockerfile完成镜像构建。

内容的提问来源于stack exchange,提问作者VANSHIKA SINGOLIA

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.23 10:18:10