File tree Expand file tree Collapse file tree 1 file changed +30
-3
lines changed
content/manuals/compose/how-tos Expand file tree Collapse file tree 1 file changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -99,11 +99,38 @@ services:
9999 b :
100100 image : service_b
101101 build :
102- context : b/
103102 dockerfile : b.Dockerfile
104103 additional_contexts :
105- # `FROM service_a` will be resolved as a dependency on service a which has to be built first
106- service_a : " service:a"
104+ # `FROM service_a` will be resolved as a dependency on service "a" which has to be built first
105+ service_a : " service:a"
106+ ` ` `
107+
108+ Using additional context, you can refer to image built by another service without the need to explictly name it:
109+
110+ b.Dockerfile:
111+
112+ ` ` ` dockerfile
113+
114+ FROM base_image
115+ # `base_image` doesn't resolve to an actual image. This is used to point to a named additional context
116+
117+ # build service b
118+ ```
119+
120+ Compose file:
121+
122+ ``` yaml
123+ services :
124+ a :
125+ build :
126+ dockerfile : a.Dockerfile
127+ # built image will be tagged <project_name>_a
128+ b :
129+ build :
130+ dockerfile : b.Dockerfile
131+ additional_contexts :
132+ # `FROM base_image` will be resolved as a dependency on service "a" which has to be built first
133+ base_image : " service:a"
107134` ` `
108135
109136## Build with Bake
You can’t perform that action at this time.
0 commit comments