This wiki was updated to MediaWiki 1.37. If you notice any issues, please report them to admin[at]


Jump to: navigation, search

Development and contribution


Branch project of devel:kubic:containers

Let's start from creating a branch project of devel:kubic:containers and fetching it to your local workstation:

mkdir obs
cd obs
for image in $(osc ls devel:kubic:containers); do osc bco devel:kubic:containers $image; done
cd home\:*:branches:devel:kubic:containers

Building an image

If you want to build a container image, go to the one of subdirectories and execute osc build container command. For example:

cd kubic-multus-image
osc build container

Creating a new image

Name of a new image should follow the naming convention: kubic-$name-image.

Let's assume that you want to create an image with name `foobar`. Start from creating the "package" on OBS:

osc mkpac kubic-foobar-image

Every image contains the following files:

  • _service - a file which configures OBS services
  • kubic-$name-image.changes - a changelog file created and updated by osc vc command
  • kubic-$ - a KIWI file which defines the image - metadata, packages to install etc.

Let's start from creating the kubic-$ file. Assuming that we want to install a foobar RPM package in that image and we want to execute the /usr/bin/foobar command by default, the content should look like:

<?xml version="1.0" encoding="utf-8"?>

<!-- OBS-ExcludeArch: i586 s390 -->

<image schemaversion="6.5" name="kubic-foobar-image" xmlns:suse_label_helper="com.suse.label_helper">
  <description type="system">
    <author>Thorsten Kukuk</author>
    <specification>Foobar application</specification>
        maintainer="Thorsten Kukuk <>">
        <entrypoint execute="/usr/bin/foobar"/>
          <suse_label_helper:add_prefix prefix="org.opensuse.kubic.foobar">
            <label name="org.opencontainers.image.title" value="openSUSE Kubic foobar container"/>
            <label name="org.opencontainers.image.description" value="Image containing foobar for openSUSE Kubic."/>
            <label name="org.opencontainers.image.version" value="%PKG_VERSION%-%RELEASE%"/>
            <label name="org.opencontainers.image.created" value="%BUILDTIME%"/>
            <label name="org.opensuse.reference" value=""/>
            <label name="org.openbuildservice.disturl" value="%DISTURL%"/>
        <history author="Thorsten Kukuk <>">openSUSE Kubic foobar container</history>
    <source path="obsrepositories:/"/>
  <packages type="bootstrap">
    <package name="foobar"/>

The usual convention to for versioning container images is to use the version of containerized software as the image tag and version. In our case it means, that the foobar image should have container version and tag which comes from the foobar package version.

To automate that process, create a _service with the following content:

    <service mode="buildtime" name="kiwi_metainfo_helper"/>
    <service name="replace_using_package_version" mode="buildtime">
        <param name="file"></param>
        <param name="regex">%PKG_VERSION%</param>
        <param name="parse-version">patch</param>
        <param name="package">foobar</param>
    <service mode="buildtime" name="kiwi_label_helper"/>

And at the end, let's add a changelog file entry with the command:

osc vc

Usually the first changelog entry is - Initial release.

After that, check whether the image builds:

osc build container

It it does, commit your changes and submit to devel:kubic:containers:

osc submitrequest home:$user:branched:devel:kubic:containers kubic-foobar-image devel:kubic:containers kubic-foobar-image