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의 UBI(Universal Base Image)를 활용해서 작업 효율성을 개선하세요
Red Hat의 UBI(Universal Base Image)를 활용해서 작업 효율성을 개선하세요
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 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트
오픈 하이브리드 클라우드
하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요
보안
환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보
엣지 컴퓨팅
엣지에서의 운영을 단순화하는 플랫폼 업데이트
인프라
세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보
애플리케이션
복잡한 애플리케이션에 대한 솔루션 더 보기
오리지널 쇼
엔터프라이즈 기술 분야의 제작자와 리더가 전하는 흥미로운 스토리
제품
- Red Hat Enterprise Linux
- Red Hat OpenShift Enterprise
- Red Hat Ansible Automation Platform
- 클라우드 서비스
- 모든 제품 보기
툴
체험, 구매 & 영업
커뮤니케이션
Red Hat 소개
Red Hat은 Linux, 클라우드, 컨테이너, 쿠버네티스 등을 포함한 글로벌 엔터프라이즈 오픈소스 솔루션 공급업체입니다. Red Hat은 코어 데이터센터에서 네트워크 엣지에 이르기까지 다양한 플랫폼과 환경에서 기업의 업무 편의성을 높여 주는 강화된 기능의 솔루션을 제공합니다.