Google Cloud Build Docker build-arg不被尊重 [英] Google Cloud Build Docker build-arg not respected

查看:82
本文介绍了Google Cloud Build Docker build-arg不被尊重的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Google Cloud Build时遇到问题,尽管该命令在本地运行正常,但docker build命令似乎没有接受build-arg选项.

I'm having a problem with Google Cloud Build where the docker build command doesn't seem to be accepting the build-arg option, even though this same command works as expected on local:

Dockerfile:

Dockerfile:

ARG ASSETS_ENV=development
RUN echo "ASSETS_ENV is ${ASSETS_ENV}"

构建命令:

docker build --build-arg="ASSETS_ENV=production" .

本地结果:

ASSETS_ENV is production

云构建的结果:

ASSETS_ENV is development

推荐答案

好吧,此修复程序在云构建yaml配置中:

Ok the fix was in the cloud build yaml config:

之前:

- name: 'gcr.io/cloud-builders/docker'
  args: ['build', '--build-arg="ASSETS_ENV=production"', '.']

之后:

- name: 'gcr.io/cloud-builders/docker'
  entrypoint: 'bash'
  args: ['-c', 'docker build --build-arg="ASSETS_ENV=production" .']

这篇关于Google Cloud Build Docker build-arg不被尊重的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆