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 prime of all of it they’re fairly related. One factor they will each do is empower you to construct your photos for use for customized container deployments. This implies you’ll be able to pull down an official picture after which commit your modifications in order that picture may be re-used for extra customized deployments.
SEE: Hiring package: Again-end Developer (TechRepublic Premium)
I’m going to indicate you ways that is finished by means of the official Ubuntu picture that shall be pulled down from docker.io. By doing this you’ll be able to 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 comparable to Rocky Linux, AlmaLinux, RHEL or CentOS.
How you can pull the Ubuntu picture
The very first thing we’ll do is pull the most recent Ubuntu picture from Docker.io. To do this, log in to your Linux distribution, open a terminal window and concern the command:
podman pull ubuntu:newest
How you can 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
You must end up on the bash immediate of the newly working 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 every other functions you need. For instance, should you’ll must do Java improvement, set up the most recent JRE with:
apt-get set up default-jre -y
How you can create your new picture
Exit from the working container with the exit command the then commit the modifications to the working container with:
podman commit ubuntu-dev
Subsequent, we have to find the ID of the picture with:
podman photos
You must now see a picture listed with the <non> label underneath REPOSITORY. That picture must also have an related ID, which shall 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, once you concern the command podman photos, it is best 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 would possibly appear to be this:
podman create --name ubuntu-web ubuntu-dev-base
And that’s all there may be to create a customized picture in your Podman deployments.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the most recent tech recommendation for enterprise professionals from Jack Wallen.