docker build with --build-arg 带有多个参数 [英] docker build with --build-arg with multiple arguments

查看:242
本文介绍了docker build with --build-arg 带有多个参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据文档,可以为标志 --build-arg 定义多个参数,但我不知道如何.我尝试了以下方法:

According to the documentation, it's possible to define multiple args for the flag --build-arg, but I can't find out how. I tried the following:

docker build -t essearch/ess-elasticsearch:1.7.6 --build-arg number_of_shards=5 number_of_replicas=2 --no-cache .

=> 这会返回一个错误.

=> This returns an error.

我也试过了:

docker build -t essearch/ess-elasticsearch:1.7.6 --build-arg number_of_shards=5,number_of_replicas=2 --no-cache .

=> 这会将一个变量 number_of_shards 设置为值5,number_of_replicas=2"

=> This sets one variable, number_of_shards, to the value "5,number_of_replicas=2"

知道如何定义多个参数吗?

Any idea how I can define multiple arguments?

推荐答案

对每个参数使用 --build-arg.

如果您要传递两个参数,请在每个参数中添加 --build-arg,例如:

If you are passing two argument then add --build-arg with each argument like:

docker build 
-t essearch/ess-elasticsearch:1.7.6 
--build-arg number_of_shards=5 
--build-arg number_of_replicas=2 
--no-cache .

这篇关于docker build with --build-arg 带有多个参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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