How to create custom images with Podman

Uncategorized

Jack Wallen strolls you through the actions for creating customized images for Podman implementations with the dedicate command.

Podman is a near 1:1 replacement for the Docker container engine. Although they are quite various below the hood, on top of everything they are quite similar. One thing they can both do is empower you to build your images to be utilized for customized container implementations. This suggests you can take down an official image and then dedicate your changes so that image can be re-used for more customized implementations.

SEE: Hiring kit: Back-end Developer (TechRepublic Premium)

I’m going to reveal you how this is done by method of the main Ubuntu image that will be pulled down from docker.io. By doing this you can customize the Ubuntu image to your precise requirements and after that deploy new containers based on the altered image.

What you’ll require to develop a custom-made image with Podman

To follow along, you’ll require an operating system that supports Podman such as Rocky Linux, AlmaLinux, RHEL or CentOS.

How to pull the Ubuntu image

The very first thing we’ll do is pull the latest Ubuntu image from Docker.io. To do that, log in to your Linux distribution, open a terminal window and provide the command:

podman pull ubuntu: latest

How to deploy and customize a container with the image

Next, we need to deploy a container with our freshly pulled image. This can be attained with:

podman run -ti– name ubuntu-dev ubuntu: latest

You should find yourself at the bash prompt of the recently running container.

Must-read designer protection

Update apt with:

apt-get update

We’ll now install the NGINX web server with the command:

apt-get set up nginx -y

You can set up any other applications you want. For example, if you’ll require to do Java development, install the current JRE with:

apt-get install default-jre -y

How to develop your brand-new image

Exit from the running container with the exit command the then commit the modifications to the running container with:

podman devote ubuntu-dev

Next, we need to find the ID of the image with:

podman images

You ought to now see an image noted with the label under REPOSITORY. That image ought to also have an associated ID, which will be a random string of characters. Copy that string and then tag the image with a brand-new name thus:

podman tag ID ubuntu-dev-base

Where ID is the image ID.

You can tag the new image with any name you like. Now, when you release the command podman images, you must see your newly-tagged image noted like this:

localhost/ubuntu-dev-base latest 4bdac71c4932 2 minutes ago 563 MB

If you want to deploy a container based on that new image, the command might appear like this:

podman create– name ubuntu-web ubuntu-dev-base

Which’s all there is to create a custom-made image for your Podman deployments.

Subscribe to TechRepublic’s How To Make Tech Deal With YouTube for all the current tech suggestions for company pros from Jack Wallen.



Source

Leave a Reply

Your email address will not be published. Required fields are marked *