Using the commandline
Using the image-builder CLI
An image is specified by a blueprint and an image type. Unless you specify otherwise, it will use the same distribution and version (e.g. Fedora 43) as the host system. The architecture will always be the same as the one on the host.
Create a blueprint
Create a .toml file:
$ vim fedora-43-base.toml
Define the details of the image in the fedora-43-base.toml file:
name = "fedora-43-custom"
description = "A Fedora 43 base system with tmux"
version = "0.0.1"
[[packages]]
name = "tmux"
version = "*"
Building an image
To build an image, use the build command. Specify the image type (e.g., qcow2, ami, vmdk), the distribution as fedora-43, and point to your local blueprint.
$ image-builder build qcow2 \
--distro fedora-43 \
--blueprint fedora-43-base.toml \
--output-dir ./build-output
The process runs in your terminal and provides updates about the progress of the build. The finished image is placed directly in the ./build-output directory.
[/] Image building step
[6 / 6] Pipeline qcow2 [------------------------------------->] 100.00%
[2 / 2] Stage org.osbuild.qemu [----------------------------->] 100.00%
Message: Finished pipeline qcow2
Image build successful, results:
build-output/fedora-43-server-qcow2-aarch64.qcow2
Reviewing Supported Targets
You can verify the supported architectures and formats for Fedora 43 by using the list command:
$ image-builder list --filter distro:fedora-43
An image is specified by a blueprint and an image type. Unless you specify otherwise, it will use the same distribution and version (e.g. Fedora 39) as the host system. The architecture will always be the same as the one on the host.
Blueprints management using composer-cli
osbuild-composer provides storage for blueprints. To store a blueprint.toml blueprint file, run this command:
$ composer-cli blueprints push blueprint.toml
To verify that the blueprint is available, list all currently stored blueprints:
$ composer-cli blueprints list
base-image-with-tmux
To display the blueprint you have just added, run the command:
$ sudo composer-cli blueprints show base-image-with-tmux
name = "base-image-with-tmux"
description = "A base system with tmux"
version = "0.0.1"
modules = []
groups = []
[[packages]]
name = "tmux"
version = "*"
Building an image using composer-cli
To build a customized image, start by choosing the blueprint and image type you would like to build. To do so, run the following commands:
$ sudo composer-cli blueprints list
$ sudo composer-cli compose types
and trigger a compose (example using the blueprint from the previous section):
$ composer-cli compose start base-image-with-tmux qcow2
Compose ab71b61a-b3c4-434f-b214-1e16527766ff added to the queue
Note that the compose is assigned with a Universally Unique Identifier (UUID), that you can use to monitor the image build progress:
$ composer-cli compose info ab71b61a-b3c4-434f-b214-1e16527766ff
ab71b61a-b3c4-434f-b214-1e16527766ff RUNNING base-image-with-tmux 0.0.1 qcow2 2147483648
Packages:
tmux-*
Modules:
Dependencies:
At this time, the compose is in a "RUNNING" state. Once the compose reaches the "FINISHED" state, you can download the resulting image by running the following command:
$ sudo composer-cli compose results ab71b61a-b3c4-434f-b214-1e16527766ff
ab71b61a-b3c4-434f-b214-1e16527766ff.tar: 455.18 MB
$ fd
ab71b61a-b3c4-434f-b214-1e16527766ff.tar
$ tar xf ab71b61a-b3c4-434f-b214-1e16527766ff.tar
$ fd
ab71b61a-b3c4-434f-b214-1e16527766ff-disk.qcow2
ab71b61a-b3c4-434f-b214-1e16527766ff.json
ab71b61a-b3c4-434f-b214-1e16527766ff.tar
logs
logs/osbuild.log
From the example output above, the resulting tarball contains not only the qcow2 image, but also a JSON file, which is the osbuild manifest (see the Developer Guide for more details), and a directory with logs.
For more options, see the help text for composer-cli:
$ sudo composer-cli compose help
Tip: Booting the image with qemu
If you want to quickly run the resulting image, you can use qemu:
$ qemu-system-x86_64 \
-enable-kvm \
-m 3000 \
-snapshot \
-cpu host \
-net nic,model=virtio \
-net user,hostfwd=tcp::2223-:22 \
ab71b61a-b3c4-434f-b214-1e16527766ff-disk.qcow2
Be aware that you must specify a way to access the machine in the blueprint. For example, you can create a user with known password, set an SSH key, or enable cloud-init to use a cloud-init ISO file.