docker 1.9.0版本之后,已经支持docker build参数化构建。

docker 版本更新记录:

 【云计算】docker build如何支持参数化构建?

github讨论:

【云计算】docker build如何支持参数化构建?

 【云计算】docker build如何支持参数化构建?

 

参开资料:

https://github.com/docker/docker/issues/14634

http://stackoverflow.com/questions/34174499/docker-build-argument

https://github.com/docker/docker/blob/master/CHANGELOG.md#190-2015-11-03

https://github.com/docker/docker/issues/18119 

Allow using environment variables in `FROM`https://github.com/docker/docker/issues/18119