Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

bootc

Manage an image-mode system: show the booted image, update to a new image, switch to another one, or roll back — all as one transaction.

Niveau
Extra
Groep
Softwarepakketten
Root nodig
Ja
Pakket
bootc
Ook
bootc-image-builder

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

In image mode for RHEL, the operating system is a bootable container image (built FROM registry.redhat.io/rhel10/rhel-bootc). bootc runs on the installed system. bootc upgrade downloads a newer build of the image the system follows and stages it for the next boot; bootc switch makes the system follow another image; bootc rollback boots the previous image again.

/usr comes from the image and is read-only. /etc is kept and merged with the image's /etc at every update. /var is local data and is never changed by an update. To change the system, change the Containerfile and build a new image — not dnf install on the server. Disk images are made with bootc-image-builder (a container image).

Zo schrijf je het

bootc COMMAND [OPTION]...
bootc upgrade [--check | --apply]
bootc switch [OPTION]... IMAGE

Belangrijkste delen

Commands

status
Show the booted, staged and rollback images.
upgrade
Download and stage a newer build of the current image.
switch IMAGE
Follow another image (another tag or repository).
rollback
Boot the previous image at the next reboot.
edit
Change the host settings (image, transport) in an editor or from a file.
usr-overlay
Make /usr writable with a temporary layer, until the next reboot.
install to-disk DEVICE
Install the running container image to a disk (run inside the image with podman).
install to-filesystem DIR
Install into a mounted file system.
install to-existing-root
Replace the OS of an existing system with the image.
container lint
Check a container image for problems (run in the build).
image list
List images in the bootc storage.
image copy-to-storage
Copy the booted image to the Podman storage.

Opties 21

Meest gebruikt

status

--format=FORMAT
Output as humanreadable, yaml or json.
--booted
Only the booted image.
--json
Same as --format json.

upgrade

--check
Only check if there is an update; download the metadata only.
--apply
Stage the update and reboot at once.
--quiet
Less output.
--soft-reboot=MODE
Use a soft reboot when possible (required or auto).

switch

--transport=TRANSPORT
registry (default), oci, oci-archive, containers-storage.
--apply
Reboot at once into the new image.
--retain
Keep the current image as rollback target.
--enforce-container-sigpolicy
Check signatures with the container policy.
--quiet
Less output.

rollback

--apply
Reboot at once.

install (to-disk, to-filesystem)

--wipe
Wipe the disk first (to-disk).
--filesystem=TYPE
Root file system type (xfs, ext4, btrfs).
--root-size=SIZE
Size of the root partition.
--karg=ARG
Add a kernel argument.
--root-ssh-authorized-keys=FILE
Install SSH keys for root.
--target-imgref=IMAGE
The image the installed system follows for updates.
--generic-image
Make an image that fits any hardware (for disk images).
--via-loopback
Install into a disk image file.

Voorbeelden 11

$ als gewone gebruiker# als root (of met sudo)

  1. 1Show what the system runs

    sudo bootc status
    sudo bootc status --format json | jq '.status.booted.image.image.image'
    "quay.io/s0sta/web-bootc:prod"
  2. 2Check for an update without changing anything

    sudo bootc upgrade --check
  3. 3Download an update, use it at the next reboot

    sudo bootc upgrade
    sudo systemctl reboot
  4. 4Update and reboot in one step

    sudo bootc upgrade --apply
  5. 5Follow another image (for example a new major tag)

    sudo bootc switch quay.io/s0sta/web-bootc:2.0
    sudo bootc switch --apply quay.io/s0sta/web-bootc:prod
  6. 6Go back after a bad update

    sudo bootc rollback
    sudo systemctl reboot

    The previous image boots again; /etc and /var keep their state.

  7. 7Turn automatic updates on or off

    systemctl status bootc-fetch-apply-updates.timer
    sudo systemctl disable --now bootc-fetch-apply-updates.timer
  8. 8Install a debug tool for a short test

    sudo bootc usr-overlay
    sudo dnf install -y strace

    The overlay is gone after the next reboot.

  9. 9Check the image in the build pipeline (DevSecOps)

    cat Containerfile
    FROM registry.redhat.io/rhel10/rhel-bootc:10.0
    RUN dnf -y install httpd && dnf clean all && systemctl enable httpd
    RUN bootc container lint
    podman build -t quay.io/s0sta/web-bootc:1.0 .
  10. 10Make a qcow2 disk with bootc-image-builder

    podman run --rm -it --privileged --pull=newer --security-opt label=type:unconfined_t -v ./config.toml:/config.toml:ro -v ./output:/output -v /var/lib/containers/storage:/var/lib/containers/storage registry.redhat.io/rhel10/bootc-image-builder:latest --type qcow2 quay.io/s0sta/web-bootc:1.0
    ls output/qcow2/
    disk.qcow2
  11. 11Install the image to a second disk from a running RHEL host

    podman run --rm --privileged --pid=host -v /dev:/dev -v /var/lib/containers:/var/lib/containers --security-opt label=type:unconfined_t quay.io/s0sta/web-bootc:1.0 bootc install to-disk --wipe /dev/vdb

Let op

  • Files put in /var by the Containerfile are copied only at the first install; updates never change /var.
  • dnf install on the running system fails (/usr is read-only). Add packages to the Containerfile.
  • A rollback target exists only after the first upgrade or switch.

Bestanden

/usr
Read-only, from the image.
/etc
Local changes kept and merged with the image at updates.
/var
Local data, kept across updates and rollbacks.
/usr/lib/bootc/kargs.d/
Kernel arguments that come with the image.

Tips om te onthouden

  • Follow a moving tag (:prod) on servers; build fixed tags (:1.0, :1.1) in CI and move :prod when tests pass.
  • Sign images in CI and turn on --enforce-container-sigpolicy so servers only boot signed images.

Exitcodes

0Success.
1Error.