What is the best practice to build a container for RHEL8

  • 投稿日:
  • by
  • カテゴリ:

While reading RH's article for container management, I needed to think about $subject.

As you can see the article, we have two options to start a container on RHEL8. They are (2) and (4) in the table below.

 Who starts a container
dockerdsystemd + Podman
init method
in container
init(1)(2)
systemd(3)(4)

On the other hands, most of Linux distributions adopt dockerd, we need to consider (1) and (3) in the table above.

If you run your containers only on RHEL8, the problem is so simple. You can choose (2) or (4) according to your favorite. The (2) requires you to write a *.service file under /etc/systemd/ for systemd, and the (4) also makes you annoyed with an illegible Dockerfile including the contents of *.service even though using 'COPY' command in it. Also, the (4) might lead an increase of the size of a container due to systemd installed into a container.

The interoperability between non-RHEL distributions and RHEL is another essential point that you must think over. Of course, all we want to use same Dockerfile except 'FROM' line among all environments where containers are running such as RHEL, AKS (Azure k8s Services), ACI (Azure Container Services), and so on. The portability is the thing we can't ignore.

I arrived at a conclusion. The (1) for non-RHEL distributions and the (2) for RHEL are the best.