You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/docs/for-app-developers/concepts/base-images/run.md
+31-21Lines changed: 31 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,36 +11,46 @@ The **run image** provides the base image for application images.
11
11
12
12
<!--more-->
13
13
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.
15
15
16
16
### Run image mirrors
17
17
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`.
24
19
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.
27
22
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"]
30
40
```
31
41
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:
34
43
35
44
```bash
36
-
$ pack build example/app
45
+
$ pack build registry.example.com/example/app
37
46
```
38
47
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.
42
53
>
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`.
0 commit comments