Scroll to navigation

IMAGE-FACTORY(1) image-factory’s Manual IMAGE-FACTORY(1)

NAME

image-factory - build golden Linux images

SYNOPSIS

image-factory [-h|--help] [-c|--cache-dir CACHE_DIR] [-f|--format {qcow2,raw}] [--image-size IMAGE_SIZE] [--mac MAC] [--installer-logs] [--no-installer-logs] [--log-file] [--no-log-file] [--log-filename LOG_FILENAME] image

DESCRIPTION

image-factory is a command line tool for building golden Linux images. It uses virt-install to do installations via the network. The installation and configuration of the images is done using the netinstall support from the distributions, i.e.

preseed for Debian/Ubuntu
Kickstart for CentOS/Fedora
AutoYaST for openSUSE

image-factory is used by IONOS Cloud to build the golden public Linux images for their Enterprise Cloud. The configuration files are shipped with this project to allow anyone to rebuild their images.

image-factory runs following steps:

Create a virtual RAW image using qemu-img.
Cache linux kernel and initrd.
Run installation using virt-install. qemu:///session is used as session for normal users and qemu:///system when run as root.
The installation partition is mounted and the installer logs are removed.
zerofree is run on the partition.
If format is set to qcow2, the virtual raw images will be converted to qcow2 using qemu-img.
The SHA 256 sum is calculated for the image.
The image will be uploaded to all locations configured in upload_destinations.
If post-build-command is configured, the specified command will be executed.

OPTIONS

Show a help message and exit
Cache directory (default: ~/.cache/image-factory or var/cache/image-factory for root)
Image format to use (default: raw)
Size of the raw image (default: 2G)
MAC address used in the installation machine
Print installer logs into logging output
Do not print installer logs into logging output
Store logs into a file (in addition to stdout/stderr)
Do not store logs into a file (in addition to stdout/stderr)
log into specified file
Image to build. The date in form of YYYY-MM-DD and the file format suffix will be added to the generated image filename.

CONFIGURATION

Each image needs to be also configured in /etc/image-factory.conf or ~/.config/image-factory.conf. These configuration files use the INI file format. The image name will be used as section and following keys are used:

Extra kernel parameter for the netboot image to use
Cache directory (default: ~/.cache/image-factory or var/cache/image-factory for root). Can be overridden by --cache-dir.
Number of CPU cores to use during installation. Default: 1
Image format to use. Can be qcow2 or raw (default). Can be overridden by --format.
Size of the raw image (default: 2G). Can be overridden by --image-size.
URI of the netboot installer initrd. Supported schemes are file:, http:, https:, and rsync:. Unless using file:, the specified initrd will be cached locally.
Boolean whether to print installer logs into logging output. Can be overridden by --installer-logs or --no-installer-logs.
Boolean whether to keep raw image (in case format is not raw). Default is False.
Filename of the Kickstart file. Needed when using Kickstart on CentOS/Fedora.
URI of the netboot installer Linux kernel. Supported schemes are file:, http:, https:, and rsync:. Unless using file:, the specified kernel will be cached locally.
Boolean whether to store logs into a file (in addition to stdout/stderr). Can be overridden by --log-file or --no-log-file.
Filename to log into (if enabled). Can be overridden by --log-filename.
MAC address used in the installation machine. Can be overridden by --mac.
Optional command to run after the image was successfully built. The name of the image will be passed as first argument.
Filename of the preseed file. Needed when using preseed on Debian/Ubuntu.
Memory for virtual machine to use during installation.
Comma-separated list of upload destinations. Each upload destination needs a section in the configuration file (see UPLOAD DESTINATION CONFIGURATION below). To disable the upload, let upload_destinations undefined or set to an empty string.
VNC port for the installation virtual machine. It is recommended to bind the VNC port to localhost only.
Filename of the AutoYaST file. Needed when using AutoYaST on openSUSE.

UPLOAD DESTINATION CONFIGURATION

Each upload destination configured in upload_destinations needs a section in the INI configuration, where at least upload_type and upload_target are set. Following keys are accepted:

Additional command to run after a successful upload. ${image} can be used as parameter in post-upload-command. If multiple commands are needed, suffix the key with a number (counting up from 1), e.g. post-upload-command1.
Additional arguments for the upload command to use, e.g. --progress for uploads with rsync.
Upload target in the format the upload type supports it.
Type of upload. Currently only rsync is supported.

SEE ALSO

qemu-img(1), virt-install(1), zerofree(8)

AUTHOR

Benjamin Drung <benjamin.drung@cloud.ionos.com>

2020-08-05 image-factory