Replacing Docker with Podman in the syslog-ng build container

The syslog-ng source code includes a container-based build system. You can use it to generate source tarballs (the official syslog-ng release tarball is also generated this way) and to build packages for RHEL 7 and different Debian and Ubuntu releases as well. It was originally built around Docker, but as the general availability of RHEL 8 is drawing near, I wanted to know how difficult it is to replace Docker with Podman in the syslog-ng build system. Originally I tested it on Fedora Silverblue (Silverblue), then a week later on RHEL 8 Beta. While the syslog-ng build scripts do not support these distributions (yet), the point was to check Podman as a Docker replacement.

TL;DR: yes, it worked perfectly with very minimal effort. For a quick how-to and information about a minor problem I encountered, read my blog post below.

Before you begin

Before you can do your test build, you need to setup your environment. You need Git, Podman, Buildah and the make command installed. Based on your environment, the installation is quite different:

Silverblue

First of all, make sure you are using the latest updates available. Without the updates, running containers as a user instead of root can use extreme amounts of storage space (that isover 30 gigabytes of disk space instead of less than three). You can read more about this problem at https://github.com/containers/buildah/issues/1040

To update Silverblue, use:

rpm-ostree update

Git, Podman and buildah are installed on Silverblue by default, but you also need the make command. While Silverblue comes as an immutable and easy-to-rollback software image, luckily you can layer regular Fedora packages above it. To install make, use:

rpm-ostree install make

Before the update and package install goes live, you need to reboot your system. Yes, it is a little inconvenient, but the easy rollback is worth those few extra seconds.

RHEL 8 Beta

The RHEL 8 Beta was released in November and there are no updates for it. As the disk wasting problem was fixed recently, I recommend that you run the build script as root (unless you have a large enough /home partition)..

You have to install container tools:

yum module install container-tools

Also, install the make command:

dnf install make

The test

Now you are ready to go. The process and the results are exactly the same, regardless of whether you start it as root or as a regular user. The only difference, as mentioned above, is that on RHEL 8 Beta an order of magnitude more disk space is used if you start the process as a regular user. This will hopefully be fixed for the final release.

First, check out the syslog-ng source code from GitHub:

git clone https://github.com/balabit/syslog-ng

Once it is ready, change to the freshly created syslog-ng directory. Now open the file dbld/rules in your favorite text editor and search for the following line:

DOCKER=docker

Replace 'docker' with 'podman' after the equal sign, then save the file and exit. That is all the change you have to do, and you are ready to build syslog-ng for any of the platforms supported by the build scripts.

For example, if you want to build packages for RHEL / CentOS 7, you can do that using the following command:

dbld/rules rpm-centos7

This will first download a Ubuntu-based image from the Docker hub and create a syslog-ng source tarball. Next, the command downloads a CentOS 7-based image to build the syslog-ng CentOS 7 packages.

Once the build is ready, you will find the source tarball and the rpm files under the dbld/build/ directory.

Result

There was no need to change anything else in the build scripts. Only the 'docker' command was replaced by 'podman'. This simple replacement method worked without any further modifications on both Fedora Silverblue and RHEL 8 Beta.

If you have questions or comments related to syslog-ng, do not hesitate to contact us. You can reach us by email or you can even chat with us. For a list of possibilities, check our GitHub page under the “Community” section at https://github.com/balabit/syslog-ng. On Twitter, I am available as @PCzanik.

Anonymous