如何在 docker-compose 中传递参数? [英] How to pass arguments within docker-compose?
本文介绍了如何在 docker-compose 中传递参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Docker 1.9 允许将参数传递给 dockerfile.见链接:https://docs.docker.com/engine/reference/builder/#参数
Docker 1.9 allows to pass arguments to a dockerfile. See link: https://docs.docker.com/engine/reference/builder/#arg
如何在 docker-compose.yml 中传递相同的参数?
如果可能,也请提供一个例子.
How can I pass the same arguments within docker-compose.yml?
Please provide an example too, if possible.
推荐答案
Compose 文件格式 1.6 中添加了此功能.
This feature was added in Compose file format 1.6.
参考:https://docs.docker.com/compose/compose-文件/#args
services:
web:
build:
context: .
args:
FOO: foo
这篇关于如何在 docker-compose 中传递参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文