Building OCK Images Examples

Provides examples of using the ock-forge script to build OCK images.

Example 4-1 Building a typical Qcow2 image

A typical invocation builds Qcow2 images. The ock-forge script does all the work required. This example generates a new Qcow2 image, attaches it as a block device, partitions the disk, formats the partitions, installs the OS, and generates an OSTree archive:

sudo ./ock-forge -d /dev/nbd0 -D out/1.31/boot.qcow2 \
    -i container-registry.oracle.com/olcne/ock-ostree:1.31 \
    -O ./out/1.31/archive.tar \
    -C ./ock -c configs/config-1.31 -P

Example 4-2 Building a Qcow2 image from GitHub

The ock-forge script can copy configurations from inconvenient places to more convenient places. This example builds a Qcow2 and OSTree image from scratch, using the OCK GitHub repository as a source of truth. The clone of the repository is retained and can be reused in later invocations:

sudo ./ock-forge -d /dev/nbd0 -D out/1.31/boot.qcow2 \
    -i container-registry.oracle.com/olcne/ock-ostree:1.31 \
    -O ./out/1.31/archive.tar \
    -C ./ock -c configs/config-1.31 \
    -s https://github.com/oracle-cne/ock.git -P 

Example 4-3 Build a raw disk image

This example generates a raw disk image, rather than a Qcow2 image. The generated image can be dd'ed onto a physical disk, and used to boot a system directly:

sudo ./ock-forge -d /dev/loop0 -D out/1.31/boot.iso \
    -i container-registry.oracle.com/olcne/ock-ostree:1.31 \
    -O ./out/1.31/archive.tar \
    -C ./ock -c configs/config-1.31 -P

Example 4-4 Install to a physical disk

This example installs the image to a physical block device, creating the necessary partitions:

sudo ./ock-forge -d /dev/sdb \
    -i container-registry.oracle.com/olcne/ock-ostree:1.31 \
    -O ./out/1.31/archive.tar \
    -C ./ock -c configs/config-1.31 -P

Example 4-5 Install but don't generate OSTree archive

This example performs a fresh installation of the OS, but doesn't store the contents in an OSTree container image archive:

sudo ./ock-forge -d /dev/nbd0 -C ./ock -c configs/config-1.31 -P

Example 4-6 Install from a container image

This example installs the OS using an existing OSTree container image as the source:

sudo ./ock-forge -d /dev/nbd0 -d /dev/loop0 -D out/1.31/boot.iso \
    -i container-registry.oracle.com/olcne/ock-ostree:1.31 -P