Skip to content

mmartinv/bootc-image-builder

 
 

Repository files navigation

bootc-image-builder

A container for deploying bootable container images.

Installation

Have podman installed on your system. Either through your systems package manager if you're on Linux or through Podman Desktop if you are on Mac OS or Windows. If you want to run the resulting virtual machine(s) or installer media you can use qemu.

On macOS, the podman machine must be running in rootful mode:

$ podman machine stop   # if already running
Waiting for VM to exit...
Machine "podman-machine-default" stopped successfully
$ podman machine set --rootful
$ podman machine start

Supported image types

The tool can build the following image types:

  • qcow2 (.qcow2) for use with QEMU
  • ami (.raw) for AWS EC2

The output format can be selected with the --type option (default "qcow2").

Examples

The following example builds a Fedora ELN bootable container into a QCOW2 image for the architecture you're running the command on.

mkdir output
sudo podman run \
    --rm \
    -it \
    --privileged \
    --pull=newer \
    --security-opt label=type:unconfined_t \
    -v $(pwd)/output:/output \
    quay.io/centos-bootc/bootc-image-builder:latest \
    --type qcow2 \
    quay.io/centos-bootc/fedora-bootc:eln

Running the resulting QCOW2 file on Linux (x86_64)

qemu-system-x86_64 \
    -M accel=kvm \
    -cpu host \
    -smp 2 \
    -m 4096 \
    -bios /usr/share/OVMF/OVMF_CODE.fd \
    -serial stdio \
    -snapshot output/qcow2/disk.qcow2

Running the resulting QCOW2 file on macOS (aarch64)

This assumes qemu was installed through homebrew.

qemu-system-aarch64 \
    -M accel=hvf \
    -cpu host \
    -smp 2 \
    -m 4096 \
    -bios /opt/homebrew/Cellar/qemu/8.1.3_2/share/qemu/edk2-aarch64-code.fd \
    -serial stdio \
    -machine virt \
    -snapshot output/qcow2/disk.qcow2

Volumes

  • /output - used for output files
  • /store - used for the osbuild store
  • /rpmmd - used for the dnf-json rpm metadata cache

Adding a user

bootc-image-builder accepts a --config option. --config needs to be a path to a JSON formatted file.

Example of such a config:

{
  "blueprint": {
    "customizations": {
      "user": [
        {
          "name": "foo",
          "password": "bar",
          "groups": ["wheel"]
        }
      ]
    }
  }
}

Save this config as output/config.json and run:

sudo podman run --rm -it --privileged --pull=newer --security-opt label=type:unconfined_t -v $(pwd)/output:/output quay.io/centos-bootc/bootc-image-builder:latest quay.io/centos-bootc/fedora-bootc:eln --config /output/config.json

Project

Contributing

Please refer to the developer guide to learn about our workflow, code style and more.

Repository

License

  • Apache-2.0
  • See LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 45.4%
  • Go 45.1%
  • Shell 6.5%
  • Dockerfile 3.0%