Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.7k views
in Technique[技术] by (71.8m points)

docker build with --build-arg with multiple arguments

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.

I also tried:

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

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

Any idea how I can define multiple arguments?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use --build-arg with each argument.

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 .

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...