Customers need small modular tools to work with containers, and Red Hat Enterprise Linux 8 has a number of features to address this. Today, we are going to discuss how to set up RHEL 8 to run containers with Podman, including:
-
Using Image Builder to create an OS image to use as a template for a container host.
-
Deploying container hosts with libvirt tools and running containers with Podman.
-
Examine hosts and containers performance with Web Console and PCP pmda-podman.
What is Podman?
Podman was released with Red Hat Enterprise Linux 7.6 and 8.0 as the next generation of Linux container tools, is designed to allow faster experimentation and development of features.
Podman features include rootless, kube generate, and kube play (see: "Podman can now ease the transition to Kubernetes and CRI-O"). Podman is also compatible with the Open Containers Initiative (OCI), Runtime, Image, and Distribution specifications, so customers can build container images that run on OpenShift (which uses CRI-O) or other 3rd-party OCI compliant container engines, and vice versa.
As can be seen in Figure 1, CRI-O, in Red Hat OpenShift, shares many of its underlying components with Podman. This allows Red Hat engineers to leverage knowledge gained in experiments conducted in Podman for new capabilities in OpenShift.
![Figure 1: how containers run with a container image vs. Kubernetes Figure 1: how containers run with a container image vs. Kubernetes](/rhdc/managed-files/image3_14.png)
Podman is a tool which is integrated with RHEL, so with a RHEL subscription, you can get enterprise technical support for container issues and access to best practices and updates.
Having said that, let’s get started setting up a container running environment!
Red Hat の Universal Base Image (UBI) をさらに活用する
Red Hat の Universal Base Image (UBI) をさらに活用する
Create a template of container host
First, we need a golden OS image for container hosts, so when a container developer needs a new host, it can be quickly deployed. By following the steps below, we can build a template of a container host. To set up image builder, you can run the these commands:
# yum install -y lorax-composer composer-cli cockpit-composer # systemctl enable lorax-composer.socket # systemctl start lorax-composer
Create a new blueprint by clicking on the Create Blueprint button:
![Figure 2: Creating a blueprint Figure 2: Creating a blueprint](/rhdc/managed-files/image11_0_0.png)
And specify Name and Description for the blueprint.
Name: container-host-template
Description: Container Host Template
![Figure 3: Creating a blueprint Figure 3: Creating a blueprint](/rhdc/managed-files/image2_20.png)
On the next screen, select which packages you want to include in the image.
You can use the filter bar on the left to make it easier to find packages and add them.
![Figure 4: Managing packages in Web Console Figure 4: Managing packages in Web Console](/rhdc/managed-files/image6_8.png)
To build a container host image, you should add these packages to the blueprint:
Categories |
Components |
---|---|
Container tools |
- buildah - container-selinux - containernetworking-plugins - fuse-overlayfs - oci-systemd-hook - oci-umount - podman - runc - skopeo - slirp4netns - podman-docker |
PCP |
- pcp-pmda-podman - pcp-system-tools - pcp-zeroconf |
Web Console |
- cockpit - cockpit-podman (RHEL 8.1 Beta) - cockpit-pcp |
After you include all required packages, commit your changes by clicking on the Commit button at the top of the screen. On the pop-up screen, confirm your changes and click on the Commit button to finalize.
![Confirm changes dialog Confirm changes dialog](/rhdc/managed-files/image13_0_0.png)
After the blueprint is created, you can add a new user, password, and SSH keys:
![Create user account Create user account](/rhdc/managed-files/image7_4_0.png)
When the blueprint is in place, you can build an image with the updated blueprint file. You can start the image creation process by clicking on the “Create Image” button at the top right. On the pop-up screen, select the type of image. Image Builder can create a variety of images, including AWS, Azure, OpenStack, VMware, and more.
Image Type: QEMU QCOW2 Image (.qcow2)
![Create qcow2 image Create qcow2 image](/rhdc/managed-files/image5_9_0.png)
It may take a few minutes to create the image. You can follow the progress on web console by navigating to the blueprint and clicking on the Images tab.
Deploying container hosts with libvirt tools
With the image created by Image Builder, you can customize a container host, in order to quickly deploy container hosts.
First, copy the image to save the time of downloading:
# cd /var/lib/libvirt/images # composer-cli compose list <UUID> FINISHED container-host-template-1 0.0.2 qcow2 # composer-cli compose image <UUID> # mv <UUID>.qcow2 container-host-template.qcow2 # chown qemu:qemu container-host-template.qcow2
Now, you can duplicate the template to deploy a container host (The deployment can just take a few seconds!) :
# cd /var/lib/libvirt/images # cp container-host-template.qcow2 container-host-1.qcow2 # chown qemu:qemu container-host-1.qcow2 # virt-install --name container-host-1 --memory 2048 --vcpus 2 \ --os-variant rhel8.0 --import \ --disk /var/lib/libvirt/images/container-host-1.qcow2 \ --graphics vnc,listen=127.0.0.1 \ --noautoconsole
To access the new container host, go to the web console of the virtual host, and go to Virtual Machines tab from the navigation bar. From there, we can see that the container host is booting.
![Booting a virtual host Booting a virtual host](/rhdc/managed-files/image8_4.png)
When it is up and running, login to the console and check the IP address. With the above virt-install command, you can deploy multiple container hosts as needed.
Once the container host is ready, login and check if any containers are running:
![Running podman ps in a terminal Running podman ps in a terminal](/rhdc/managed-files/image14_0.png)
Now, it is time to run your first container with Podman on RHEL 8. Let’s start with the RHEL 8 Universal Base Image:
![Running podman login and pulling image from registry.redhat.io Running podman login and pulling image from registry.redhat.io](/rhdc/managed-files/image1_29.png)
Examine hosts and containers performance
Now, the RHEL 8 UBI container is running and you can shell into the container:
![Running podman exec to shell into a container Running podman exec to shell into a container](/rhdc/managed-files/image4_13.png)
To examine the system loads of container hosts, you can use the Web Console at Dashboard tab, and see the following graph:
![CPU Graph in Web console CPU Graph in Web console](/rhdc/managed-files/image10_1.png)
Moreover, to check the performance of containers running on the host, you can utilize PCP and pmda-podman to examine containers performance or Podman Containers in Web Console.
![Container and user slices Container and user slices](/rhdc/managed-files/image12_0.png)
With RHEL 8.1, Podman containers is available as a component of the Web Console to manage containers and images. From the graph below, you can see that a RHEL 8 UBI (Universal Base Image) container is running on podman, and how much CPU and memory it is consuming. To install it, you may need RHEL 8.1 beta ISO image, and run “# yum install cockpit-podman
."
![Running containers displayed in RHEL 8 Web console Running containers displayed in RHEL 8 Web console](/rhdc/managed-files/image9_3_0.png)
Conclusion
We have looked at how to set up a template of a container host, deploy container hosts and manage container hosts and containers. Podman helps developers and admins to find, run, build, share and deploy containers on RHEL. To explore more Podman features, check out the Building, Running and Managing Containers guide for RHEL 8.
執筆者紹介
チャンネル別に見る
自動化
テクノロジー、チームおよび環境に関する IT 自動化の最新情報
AI (人工知能)
お客様が AI ワークロードをどこでも自由に実行することを可能にするプラットフォームについてのアップデート
オープン・ハイブリッドクラウド
ハイブリッドクラウドで柔軟に未来を築く方法をご確認ください。
セキュリティ
環境やテクノロジー全体に及ぶリスクを軽減する方法に関する最新情報
エッジコンピューティング
エッジでの運用を単純化するプラットフォームのアップデート
インフラストラクチャ
世界有数のエンタープライズ向け Linux プラットフォームの最新情報
アプリケーション
アプリケーションの最も困難な課題に対する Red Hat ソリューションの詳細
オリジナル番組
エンタープライズ向けテクノロジーのメーカーやリーダーによるストーリー
製品
ツール
試用、購入、販売
コミュニケーション
Red Hat について
エンタープライズ・オープンソース・ソリューションのプロバイダーとして世界をリードする Red Hat は、Linux、クラウド、コンテナ、Kubernetes などのテクノロジーを提供しています。Red Hat は強化されたソリューションを提供し、コアデータセンターからネットワークエッジまで、企業が複数のプラットフォームおよび環境間で容易に運用できるようにしています。
言語を選択してください
Red Hat legal and privacy links
- Red Hat について
- 採用情報
- イベント
- 各国のオフィス
- Red Hat へのお問い合わせ
- Red Hat ブログ
- ダイバーシティ、エクイティ、およびインクルージョン
- Cool Stuff Store
- Red Hat Summit