Jack Wallen walks you thru the steps for creating customized photos for Podman deployments with the commit command.
Podman is a close to 1:1 substitute for the Docker container engine. Though they’re fairly totally different beneath the hood, on high of all of it they’re fairly comparable. One factor they will each do is empower you to construct your photos for use for customized container deployments. This implies you may pull down an official picture after which commit your adjustments in order that picture may be re-used for extra customized deployments.
SEE: Hiring kit: Back-end Developer (TechRepublic Premium)
I’m going to indicate you ways that is carried out by means of the official Ubuntu picture that will likely be pulled down from docker.io. By doing this you may customise the Ubuntu picture to your precise specs after which deploy new containers primarily based on the modified picture.
What you’ll must create a customized picture with Podman
To observe alongside, you’ll want an working system that helps Podman resembling Rocky Linux, AlmaLinux, RHEL or CentOS.
Easy methods to pull the Ubuntu picture
The very first thing we’ll do is pull the newest Ubuntu picture from Docker.io. To do this, log in to your Linux distribution, open a terminal window and difficulty the command:
podman pull ubuntu:newest
Easy methods to deploy and modify a container with the picture
Subsequent, we have to deploy a container with our newly pulled picture. This may be achieved with:
podman run -ti --name ubuntu-dev ubuntu:newest
It is best to end up on the bash immediate of the newly operating container.
Replace apt with:
apt-get replace
We’ll now set up the NGINX internet server with the command:
apt-get set up nginx -y
You possibly can set up some other purposes you need. For instance, for those who’ll must do Java growth, set up the newest JRE with:
apt-get set up default-jre -y
Easy methods to create your new picture
Exit from the operating container with the exit command the then commit the adjustments to the operating container with:
podman commit ubuntu-dev
Subsequent, we have to find the ID of the picture with:
podman photos
It is best to now see a picture listed with the <non> label underneath REPOSITORY. That picture must also have an related ID, which will likely be a random string of characters. Copy that string after which tag the picture with a brand new identify like so:
podman tag ID ubuntu-dev-base
The place ID is the picture ID.
You possibly can tag the brand new picture with any identify you want. Now, if you difficulty the command podman photos, you need to see your newly-tagged picture listed like this:
localhost/ubuntu-dev-base newest 4bdac71c4932 2 minutes in the past 563 MB
If you wish to deploy a container primarily based on that new picture, the command may appear like this:
podman create --name ubuntu-web ubuntu-dev-base
And that’s all there may be to create a customized picture to your Podman deployments.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the newest tech recommendation for enterprise execs from Jack Wallen.