Skip to content

Commit 86fa59c

Browse files
author
Natalie Arellano
committed
Fix run image mirrors concepts page
Signed-off-by: Natalie Arellano <[email protected]>
1 parent 67d1294 commit 86fa59c

File tree

2 files changed

+33
-21
lines changed
  • content/docs
    • for-app-developers/concepts/base-images
    • for-platform-operators/how-to/build-inputs/create-builder

2 files changed

+33
-21
lines changed

content/docs/for-app-developers/concepts/base-images/run.md

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,36 +11,46 @@ The **run image** provides the base image for application images.
1111

1212
<!--more-->
1313

14-
The lifecycle requires a reference to a run image and (where necessary) possible run image mirrors in order to construct the application image.
14+
CNB tooling requires a reference to a run image and (where necessary) run image mirrors in order to construct the application image.
1515

1616
### Run image mirrors
1717

18-
Run image mirrors provide alternate locations for run images, for use during `build` or `rebase`.
19-
When running `build` with a builder containing run image mirrors, `pack` will select a run image
20-
whose registry location matches that of the specified app image (if no registry host is specified in the image name,
21-
DockerHub is assumed). This is useful when publishing the resulting app image (via the `--publish` flag or via
22-
`docker push`), as the app's base image (i.e. run image) will be located on the same registry as the app image itself,
23-
reducing the amount of data transfer required to push the app image.
18+
Run image mirrors provide alternate locations for `run images`, for use during `build` or `rebase`.
2419

25-
In the following example, assuming a builder configured with the example TOML above, the selected run image will be
26-
`registry.example.com/example/run`.
20+
When run image mirrors are defined, CNB tooling will try to find a run image that resides on the same registry as the application image,
21+
based on the image name provided.
2722

28-
```bash
29-
$ pack build registry.example.com/example/app
23+
This is to reduce the amount of data transfer required to push the application image to a registry.
24+
25+
#### Example - determining the registry
26+
27+
If the application image name is:
28+
29+
* `registry.example.com/example/app` - the registry is `registry.example.com`
30+
* `example/app` (registry omitted) - Docker Hub is assumed; the registry is `index.docker.io`
31+
32+
#### Example - determining the run image mirror
33+
34+
If your builder has a run image with mirrors defined as follows (see [how to create a builder](/docs/for-platform-operators/how-to/build-inputs/create-builder/builder) for more information):
35+
36+
```toml
37+
[[run.images]]
38+
image = "example/run"
39+
mirrors = ["registry.example.com/example/run"]
3040
```
3141

32-
while naming the app without a registry specified, `example/app`, will cause `example/run` to be selected as the app's
33-
run image.
42+
Then if you run `pack build` as follows:
3443

3544
```bash
36-
$ pack build example/app
45+
$ pack build registry.example.com/example/app
3746
```
3847

39-
> For local development, it's often helpful to override the run image mirrors in a builder. For this, the
40-
> `pack config run-image-mirrors` command can be used. This command does not modify the builder, and instead configures the
41-
> local environment.
48+
the selected run image will be `registry.example.com/example/run`.
49+
50+
> For local development, it's often helpful to override the run image mirrors in a builder.
51+
> For this, the `pack config run-image-mirrors` command can be used.
52+
> This command does not modify the builder, and instead configures the local environment.
4253
>
43-
> To see what run images are configured for a builder, the
44-
> `builder inspect` command can be used. `builder inspect` will output built-in and locally-configured run images for
45-
> a given builder, along with other useful information. The order of the run images in the output denotes the order in
46-
> which they will be matched during `build`.
54+
> To see what run images are configured for a builder, `pack builder inspect` can be used.
55+
> `pack builder inspect` will output built-in and locally-configured run images for a given builder, along with other useful information.
56+
> The order of the run images in the output denotes the order in which they will be matched during `build`.

content/docs/for-platform-operators/how-to/build-inputs/create-builder/builder.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,14 @@ image = "cnbs/sample-base-build:jammy"
5959
[run]
6060
[[run.images]]
6161
image = "cnbs/sample-base-run:jammy"
62+
mirrors = ["other-registry.example.com/cnbs/sample-base-run:jammy"]
6263

6364
# Stack (deprecated) used to create the builder
6465
[stack]
6566
id = "io.buildpacks.samples.stacks.jammy"
6667
# This image is used at runtime
6768
run-image = "cnbs/sample-base-run:jammy"
69+
run-image-mirrors = ["other-registry.example.com/cnbs/sample-base-run:jammy"]
6870
# This image is used at build-time
6971
build-image = "cnbs/sample-base-build:jammy"
7072
```

0 commit comments

Comments
 (0)