已使用以下命令,但Dockerfile中未传递环境值。 通过groovy脚本在oc容器中运行这些实例:
oc start-build -e environment=ipte2 ipte2-isell-api-7 --from-dir=./isell-python-wrapper --follow=true
**WARNING**: Specifying environment variables with binary builds is not supported.
Uploading directory "isell-python-wrapper" as binary input for the build ...
build "ipte2-isell-api-7-1" started
2)oc start-build --build-arg environment=ipte2 ipte2-isell-api-5 --from-dir=./isell-python-wrapper --follow=true
**WARNING**: Specifying build arguments with binary builds is not supported.
Uploading directory "isell-python-wrapper" as binary input for the build ...
build "ipte2-isell-api-5-1" started
error
Removing intermediate container f7ff031b18b1
Step 35/44 : COPY script/${environment}-local.conf /sum/lpp/ebb/local.conf
error: build error: lstat script/-local.conf: no such file or directory
Dockerfile
FROM wlp-base:0.1 #from statement base image
ARG environment
ENV environment=${environment}
COPY script/${environment}-local.conf
我需要在copy命令中传递上述环境值
如果我通过ENV environment=ipte2
直接在Dockerfile内部,工作正常。但是发送一个命令行参数,它无法得到它
如果您使用docker cmd进行构建,则docker build arg将起作用。。 但我看到您正在使用OC容器。。因此,您需要向BuildArgs数组添加条目,该数组位于BuildConfig的dockerStrategy定义中
例如: 在我的项目中,我使用python yaml包生成BuildConfig.yaml文件…下面是代码
您也可以参考链接https://docs.openshift.com/container-platform/3.6/dev_guide/builds/build_strategies.html#docker-strategy-build-args
这在使用简单
docker build build-arg environment=foo .
时有效我以前没有使用过
oc
,但是如果您找到一种像中那样指定build arg的方法 https://docs.openshift.com/container-platform/3.6/dev_guide/builds/build_strategies.html#docker-strategy-build-args相关问题 更多 >
编程相关推荐