Building a container image for your software¶
A container image is a lightweight, standalone software package that includes the code, tools, libraries, and settings required to run a piece of
software. The configuration for a container image is stored in a file called a Containerfile
.
Prerequisites
- Podman
- An RPM package (
auto-apps
) in an RPM package repository (/var/tmp/my_repo
)
Procedure
-
Create a
Containerfile
that includes the RPM package that you created in Packaging your application source code with RPM: -
Copy the RPM repository from
/var/tmp/my_repo
to the same directory where you have created theContainerfile
file: -
Run
podman build
in the same directory as yourContainerfile
to build the container image, and name the container imageauto-apps
: -
Start a container from your
auto-apps
container image, -
From within the running container, verify that your RPM package is present.
If the auto-apps RPM was embedded successfully in the container, the output of the
rpm -q
command displays the version of your package:
Now that you have a functional auto-apps
container image, you can embed your
containerized applications in the OS image with OSBuild.
Next steps
After creating a container image for your application, you can embed it in an OS image.
Depending on your needs, you can use one of two methods to embed the container image in your operating system image:
- Recommended method: Create the container image and add it to a remote container registry.Then, pull the container image from the remote registry to include in the OS image. This method is the only reliable, reproducible method for OS image builds and is therefore recommended.
- Development method: Create the container image and add it to a local RPM repository. Then, pull the container image from your local repository to include in the OS image. Only use this method to build OS images for development and experimentation purposes.