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
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
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
ok, the image is now available. Lets proceed to push the image to Red Hat Quay repository
podman push hellofrompodman quay.io/itechblog/hellofrompodman
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
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
Lets connect to the application
curl localhost:1080 #1080 is the port we have mentioned when creating the container.
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.