我要构建三个服务,A、B 和 C。首先应该构建 A,因为 B 和 C 依赖于 A(它们将 A 作为镜像导入)。我认为它们应该按顺序构建,但我发现它们是按随机顺序构建的?
那么,如何在 docker-compose.yml
中控制构建顺序?
最佳答案
Update: In recent practice, I have found my answer to only pertain to run ordering.
Refer to the answer by Quinten Scheppermans and the comment by Authur Weborg about dobi.
您可以使用 depends_on
控制构建顺序指令。
services:
...
B:
depends_on:
- A
C:
depends_on:
- A
关于docker - 如何控制 docker-compose 构建顺序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46295806/