File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
content/manuals/compose/how-tos Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ title: Build dependent images
55weight : 50
66---
77
8+ {{< summary-bar feature_name="Compose dependent images" >}}
9+
810To reduce push/pull time and image weight, a common practice for Compose applications is to have services
911share base layers as much as possible. You will typically select the same operating system base image for
1012all services. But you also can get one step further sharing image layers when your images share the same
@@ -19,7 +21,6 @@ image and install system package `openssl`.
1921The recommended approach is to group the shared declaration in a single Dockerfile, and use multi-stage features
2022so that service images are built from this shared declaration.
2123
22-
2324Dockerfile:
2425
2526``` dockerfile
@@ -53,7 +54,6 @@ A popular pattern is to reuse a service image as a base image in another service
5354As Compose does not parse the Dockerfile, it can't automatically detect this dependency
5455between services to correctly order the build execution.
5556
56-
5757a.Dockerfile:
5858
5959` ` ` dockerfile
@@ -82,7 +82,6 @@ services:
8282 dockerfile : b.Dockerfile
8383` ` `
8484
85-
8685Legacy Docker Compose v1 used to build images sequentially, which made this pattern usable
8786out of the box. Compose v2 uses BuildKit to optimise builds and build images in parallel
8887and requires an explicit declaration.
@@ -107,7 +106,6 @@ services:
107106 service_a : " service:a"
108107` ` `
109108
110-
111109## Build with Bake
112110
113111Using [Bake](/manuals/build/bake/_index.md) let you pass the complete build definition for all services
Original file line number Diff line number Diff line change @@ -67,8 +67,10 @@ Compose bridge:
6767 availability : Experimental
6868Config profiles :
6969 requires : Docker Desktop 4.36 and later
70+ Compose dependent images :
71+ requires : Docker Compose [2.22.0](/manuals/compose/releases/release-notes.md#2220) and later
7072Compose cgroup :
71- requires : Docker Compose [2.15.0](/manuals/compose/releases/release-notes.md#2200 ) and later
73+ requires : Docker Compose [2.15.0](/manuals/compose/releases/release-notes.md#2150 ) and later
7274Compose develop :
7375 requires : Docker Compose [2.22.0](/manuals/compose/releases/release-notes.md#2220) and later
7476Compose driver opts :
You can’t perform that action at this time.
0 commit comments