Skip to content

Commit 73ba30d

Browse files
authored
Merge pull request #5332 from jeckersb/chunked-docs
docs: expand on chunked images
2 parents 3459988 + 6ad1eaa commit 73ba30d

File tree

2 files changed

+60
-18
lines changed

2 files changed

+60
-18
lines changed

docs/build-chunked-oci.md

+33-7
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,31 @@ However, it does not support common container-native workflows such
1111
as copying content from a distinct container image.
1212

1313
The `rpm-ostree compose build-chunked-oci` command
14-
accepts an arbitrary input container image, and synthesizes a
15-
bootc (ostree container) ready image from it.
14+
accepts exactly one of:
1615

17-
At the current time, it is recommended that the input
18-
container image be derived from a reference maintained base image,
19-
such as the fedora-bootc ones. Especially if you are
20-
targeting bootc systems with this, please follow
16+
- an arbitrary input container image
17+
- a source root filesystem tree
18+
19+
and synthesizes a bootc (ostree container) ready image from it. This
20+
produces a chunked output image via the [same process](https://coreos.github.io/rpm-ostree/container/#creating-chunked-images)
21+
as `rpm-ostree compose container-encapsulate`.
22+
23+
At the current time, when using an input container image, it is
24+
recommended that the input container image be derived from a reference
25+
maintained base image, such as the fedora-bootc ones. Especially if
26+
you are targeting bootc systems with this, please follow
2127
<https://gitlab.com/fedora/bootc/tracker/-/issues/32>.
2228

2329
## Running
2430

25-
This command expects a container image already fetched into a `containers-storage:`
31+
Note that the `--from` and `--rootfs` options are mutually-exclusive;
32+
exactly one is required. Currently both `--bootc` and
33+
`--format-version=1` are required options. Additional format versions
34+
may be added in the future.
35+
36+
### Using `--from`
37+
38+
This expects a container image already fetched into a `containers-storage:`
2639
instance, and can output to `containers-storage:` or `oci`.
2740

2841
```
@@ -32,3 +45,16 @@ rpm-ostree compose build-chunked-oci --bootc --format-version=1 \
3245
--from=quay.io/exampleos/exampleos:build --output containers-storage:quay.io/exampleos/exampleos:latest
3346
podman push quay.io/exampleos/exampleos:latest
3447
```
48+
49+
### Using `--rootfs`
50+
51+
This expects a source root filesystem tree, such as one created with
52+
`rpm-ostree compose rootfs`.
53+
54+
```
55+
# assumes package system configuration in /repos
56+
rpm-ostree compose rootfs --source-root=/repos /path/to/input_manifest.yml /path/to/target_rootfs
57+
rpm-ostree compose build-chunked-oci --bootc --format-version=1 --rootfs=/path/to/target_rootfs \
58+
--output containers-storage:quay.io/exampleos/exampleos:latest
59+
podman push quay.io/exampleos/exampleos:latest
60+
```

docs/container.md

+27-11
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,17 @@ In the future, this command may perform more operations.
146146
There is now an `rpm-ostree compose image` command which generates a new base image using a treefile:
147147

148148
```
149-
$ rpm-ostree compose image --initialize-mode=if-not-exists --format=ociarchive workstation-ostree-config/fedora-silverblue.yaml fedora-silverblue.ociarchive
149+
$ rpm-ostree compose image --initialize-mode=if-not-exists --format=ociarchive \
150+
workstation-ostree-config/fedora-silverblue.yaml fedora-silverblue.ociarchive
150151
```
151152

152153
The `--initialize-mode=if-not-exists` command here is what you almost always want: to create
153154
the image if it doesn't exist, but to otherwise check for changes. It isn't the default
154155
for historical reasons.
155156

156157
```
157-
$ rpm-ostree compose image --initialize-mode=if-not-exists --format=registry workstation-ostree-config/fedora-silverblue.yaml quay.io/example/exampleos:latest
158+
$ rpm-ostree compose image --initialize-mode=if-not-exists --format=registry \
159+
workstation-ostree-config/fedora-silverblue.yaml quay.io/example/exampleos:latest
158160
```
159161

160162
## Adding container image configuration
@@ -201,25 +203,39 @@ In ostree upstream, there is a simplistic CLI (and API) that "encapsulates"
201203
a commit into a container image with a *single layer*:
202204

203205
```
204-
$ ostree container encapsulate --repo=/path/to/repo fedora/35/x86_64/silverblue docker://quay.io/myuser/fedora-silverblue:35
206+
$ ostree container encapsulate --repo=/path/to/repo fedora/35/x86_64/silverblue \
207+
docker://quay.io/myuser/fedora-silverblue:35
205208
```
206209

207210
The `encapsulate` command accepts all the same "transport prefixes" as the `skopeo`
208211
CLI. For more information, see `man skopeo`.
209212

210-
However, this "single layer" is not an efficient way to deliver content. It means
211-
that any time anything in the ostree commit changes, clients need to download
212-
a full new tarball.
213+
## Creating chunked images
213214

214-
The ostree shared library has low level APIs that support creating reproducible
215-
"chunked" images. A key adavantage of this is that if e.g. just the kernel
216-
changes, one only downloads the layer containing the kernel/initramfs
217-
(plus a metadata layer) instead of everything.
215+
The "single layer" image produced by `ostree container encapsulate`
216+
above is not an efficient way to deliver content. It means that any
217+
time anything in the ostree commit changes, clients need to download a
218+
full new tarball.
219+
220+
The ostree shared library has low level APIs that support creating
221+
reproducible "chunked" images. A key adavantage of this is that if
222+
e.g. just the kernel changes, one only downloads the layer containing
223+
the kernel/initramfs (plus a metadata layer) instead of everything.
224+
The algorithm uses generalized heuristics to pack the image content
225+
together (primarily consulting RPM metadata) into a number of layers
226+
in order to minimize the amount of data/layers modified when producing
227+
updated images in the future. The `--max-layers` option may be
228+
supplied to specify the number of layers; if not specified this
229+
defaults to a maximum of 64 layers.
218230

219231
Use a command like this to generate chunked images:
220232

221233
```
222-
$ rpm-ostree compose container-encapsulate --repo=/path/to/repo fedora/35/x86_64/silverblue docker://quay.io/myuser/fedora-silverblue:35
234+
$ rpm-ostree compose container-encapsulate --repo=/path/to/repo fedora/35/x86_64/silverblue \
235+
docker://quay.io/myuser/fedora-silverblue:35
223236
```
224237

225238
This "chunked" format is used by default by `rpm-ostree compose image`.
239+
240+
You can also create chunked images from pre-existing (typically
241+
single-layer) images using [`rpm-ostree compose build-chunked-oci`](https://coreos.github.io/rpm-ostree/build-chunked-oci/).

0 commit comments

Comments
 (0)