0% found this document useful (0 votes)
23 views2 pages

Bsics of Container Images

My NOtes of redhate that will help students to pass rhcsa exam

Uploaded by

gohelhitanshi002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views2 pages

Bsics of Container Images

My NOtes of redhate that will help students to pass rhcsa exam

Uploaded by

gohelhitanshi002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Installing container tool


#dnf install -y @container-tools

2. podman version
#podman version

3. verifying podman status


#dnf repolist all

4. To search container image


#podman images(this will list down all the available container images)

#podman search <image_name> (syntax)


exa: #podman search httpd
#podman image ls

5. To pull container image


#podman pull <image_name>:<tag>
exa: #podman pull httpd:latest

6. Listing container:
>To list all running containers on your system.
#podman ps

>If you want to see all containers, including those that have been stopped
#podman ps -a

7. Tag: to add an additional name (or tag) to an existing container image.

#podman tag <image_id> <new_image_name>:<tag>


exa: #podman tag 123abc456def myregistry.com/myrepo/myapp:latest

8. The podman run command is used to create and start a new container from a
specified image.
a. #podman run -d <image_id>
exa: podman run -d 123abc456def

b. Naming the Container: Use the --name flag to give your container a specific
name.
#podman run -d --name my-container 123abc456def

c. Port Mapping: If your container exposes a port, you can map it to the host
using the -p flag.
#podman run -d -p 8080:80 123abc456def

d. Environment Variables: You can pass environment variables to the container


using the -e flag.
# podman run -d -e ENV_VAR=value 123abc456def

9. Stopping and Removing the Container:


a. To stop a running container, you can use:
#podman stop <container_name_or_id>

b. And to remove it, use:


#podman rm <container_name_or_id>

10. To remove a container image using podman


Important Note: Ensure that no containers are currently using the image you want to
remove. If there are, you'll need to stop and remove those containers first before
you can delete the image.

a. Removing an Image by ID:


#podman rmi 123abc456def

b. Removing an Image by Name:


#podman rmi httpd:latest

c. Force Removal:
#podman rmi -f <image_id_or_name>

d. Removing all images


#podman rmi -a

11. To save and load container images using podman

a. Saving an Image
#podman save -o <filename>.tar <image_name_or_id> (syntax)
(-o <filename>.tar: Specifies the output file name where the image will be
saved.
<image_name_or_id>: The name or ID of the image you want to save.)

example: podman save -o httpd_image.tar httpd:latest

b. Loading an Image
#podman load -i <filename>.tar (syntax)
(-i <filename>.tar: Specifies the input file from which the image will be
loaded.)

example: podman load -i httpd_image.tar

Saving an Image: Use podman save to create a tar file of an image.


Loading an Image: Use podman load to restore an image from a tar file.

You might also like