Sunday, December 22, 2024
Red Hat Containers Docker Linux Podman

Build images, containers using Podman and Red Hat Quay

Use Podman to create images, push and pull images from Red Hat Quay image Repository. Create the container using the pulled image, connect to the container and the application. You can either watch the detailed video or follow the below given text blog.

Today we will talk about Podman and Red Hat Quay image Repository.

Just to give you a brief intro. Podman is a deamonless container engine for developing, managing, and running containers and container images on Linux System. Podman is an open source tool.  Its more secure than Docker as the user running a Podman container can only see and modify their own containers. 

From Red Hat enterprise Linux 8, Docker is not included and not supported by Red Hat. 

Now what is Red Hat Quay ?
Red Hat® Quay container image registry provides storage and enables you to build, distribute, and deploy containers. You can visit Quay.io for more information and to create your account.

Am connected to Red Hat Linux, version 8.2

To install podman on Red Hat or CentOS linux, we can use

yum install podman

I have Podman installed already, lets verify [On Ubuntu you can use apt-get install podman]

Podman --version
check podman version using podman --version command

Lets now create a custom image using Podman.  I have just created a Containerfile , lets open that.
Note that Podman uses Containerfile, and docker uses Dockerfile. Also by default Podman stores the data on your local folder, and its only available to you. ~/.local/share/containers. You can push to the common registry /var/lib/containers for sharing with all members.

vim Containerfile
podman containerfile file contents

So in this Containerfile am just creating a custom html page using the nginx image. Lets create the image using this Containerfile.

podman build -t hellofrompodman .   

See I put a “.” here , as the Containerfile is in the local directory. Lets execute. The image is now created. 

podman images
podman images to see the newly created image

ok, the image is now available.  Lets proceed to push the image to Red Hat Quay repository

podman push hellofrompodman quay.io/itechblog/hellofrompodman
podman push to red hat quay.io repository

Make sure you are logged in to quay.io using 

podman login quay.io


Now lets delete the image hellofrompodman from local repository,  and pull  the same image from Red Hat Quay repo

podman rmi --all  #this will remove all images
podman pull quay.io/itechblog/hellofrompodman  #this will pull the image
podman pull from red hat quay.io repository

Lets proceed to create the container using the pulled image.

podman run --name HelloFromPodman -p 1080:80 -d hellofrompodman
podman ps  #to check the containers running
podman run to create the image using name and port number and image name

Lets connect to the application 

curl localhost:1080 #1080 is the port we have mentioned when creating the container.
curl localhost  with port number to view the application in the container
browse localhost with port number in the browser to view the application.

We can now connect to the application running in the container. To connect to the container, you can use

podman container exec -it  HelloFromPodman /bin/bash

Do watch the above given Youtube video to see this in action.

Back To Top
error: Content is protected !!