Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
11 views9 pages

Images Commands Notes

The document provides detailed commands and usage for managing container images using Podman, including commands for pulling, listing, inspecting, tagging, pushing, and removing images. It outlines syntax, options, examples, and common errors for each command. Additionally, it includes use cases and tips for effective image management.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views9 pages

Images Commands Notes

The document provides detailed commands and usage for managing container images using Podman, including commands for pulling, listing, inspecting, tagging, pushing, and removing images. It outlines syntax, options, examples, and common errors for each command. Additionally, it includes use cases and tips for effective image management.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

EX_188_Images related commands

1.Podman pull:
The podman pull command is used to download a container image from a remote registry (like Docker Hub, Red
Hat, Quay.io, or private registries) to your local image store.

Syntax

podman pull [OPTIONS] IMAGE_NAME[:TAG]

• IMAGE_NAME: The name of the image (can include registry, namespace, repo, and tag).

• TAG: (Optional) The version/tag of the image (default: latest).

Image Name Formats

Format Description

Ubuntu Pulls from Docker Hub (docker.io/library/ubuntu:latest)

docker.io/library/nginx:1.23 Fully qualified Docker Hub image

quay.io/user/app:stable Image from Quay registry

registry.access.redhat.com/ubi8/ubi Red Hat UBI image

localhost:5000/myimage:v1 From a private/local registry

Examples

Pull from Docker Hub

podman pull nginx

(Internally resolves to docker.io/library/nginx:latest)

Pull a specific version

podman pull nginx:1.25

Pull from Red Hat Registry

podman pull registry.access.redhat.com/ubi8/ubi:latest

Pull from a local/private registry

podman pull --tls-verify=false localhost:5000/myimage:v1

Authentication (Optional)

If you're pulling from a private registry, first log in:

podman login docker.io

Or use credentials inline:

podman pull --creds=username:password docker.io/yourname/privimage:v1

1
EX_188_Images related commands
Common Options

Option Description

--all-tags Pull all tags for a given image

--authfile=PATH Use a custom auth file

--cert-dir=DIR Use certificates from a directory

--creds=user:pass Use credentials for private registries

--tls-verify=false Disable TLS verification (insecure)

--quiet Suppress progress output

Sample Output

Resolved "nginx" as an alias (/etc/containers/registries.conf)

Trying to pull docker.io/library/nginx:latest...

Getting image source signatures

Copying blob 8ec398bc0356 done

Copying config 27c7b80... done

Writing manifest to image destination

Storing signatures

Use-Cases

• Download images for local development

• Cache images before offline deployment

• Preload CI/CD runners

• Pull base images for builds

Common Errors & Fixes

Error Cause Fix

Error: image not found Image name/tag is wrong Verify spelling and tag

unauthorized: access denied Private repo or auth required Use podman login or –creds

TLS verification failed Insecure or self-signed registry Use --tls-verify=false

2
EX_188_Images related commands
2.Podman images :
The podman images command is used to list images that are stored locally in your Podman image store.

Basic Syntax

podman images [OPTIONS]

Common Options

Option Description

-a, --all Show all images (default hides intermediate images)

--digests Show image digests

--format Format the output using a Go template

--filter, -f Filter output based on conditions

--noheading Do not print column headings

--no-trunc Do not truncate output

--quiet, -q Only show image IDs

Examples

List all local images

podman images

List all images including intermediate layers

podman images -a

Display image digests

podman images --digests

Display only image IDs (quiet mode)

podman images -q

Filter by repository name

podman images --filter "reference=ubuntu"

Format output (e.g., only repo and tag)

podman images --format "{{.Repository}}:{{.Tag}}"

Sample Output

REPOSITORY TAG IMAGE ID CREATED SIZE

docker.io/library/ubuntu latest 26b77e58432b 2 weeks ago 29.2 MB

3
EX_188_Images related commands
3.Podman inspect:

The podman inspect command provides detailed, low-level information in JSON format about containers,
images, volumes, or pods.

Basic Syntax

podman inspect [OPTIONS] NAME|ID [...]

You can inspect:

• A container

• An image

• A pod

• A volume

Common Options

Option Description

--type Specify the object type: container, image, pod, volume

--format, -f Format the output using a Go template

--latest, -l Inspect the latest container

Examples

Inspect a container by name or ID

podman inspect my_container

Inspect an image

podman inspect ubuntu:latest

Inspect a volume

podman inspect --type volume my_volume

Inspect a pod

podman inspect --type pod my_pod

Get specific info using --format

podman inspect -f '{{.State.Status}}' my_container

This shows the container's current status (e.g., running, exited).

Sample Output (trimmed for clarity)

4
EX_188_Images related commands
"Id": "abcdef123456...",

"Created": "2025-07-01T10:30:00.123456789Z",

"Path": "/bin/bash",

"Args": [],

"State": {

"Running": true,

"Pid": 1234,

"ExitCode": 0

},

"Image": "sha256:abc123...",

"Name": "my_container"

Tip

Use tools like jq to filter and pretty-print JSON:

podman inspect my_container | jq '.[0].State'

4.Podman tag:

The podman tag command is used to add a new name (tag) to an existing local image — much like creating an
alias for easier reference or pushing to a different registry.

Syntax

podman tag [OPTIONS] SOURCE_IMAGE TARGET_IMAGE

• SOURCE_IMAGE: The image ID or name you want to tag.

• TARGET_IMAGE: The new name (optionally with registry and tag) you want to assign.

Examples

Tag an image with a new name and version

podman tag ubi8:latest myrepo/ubi8:v1

This adds a new tag myrepo/ubi8:v1 to the existing local image ubi8:latest.

Tag using a full registry path

podman tag nginx localhost:5000/nginx:test

Now you can push this image to a local registry:

podman push localhost:5000/nginx:test

5
EX_188_Images related commands
Tag by image ID

podman tag 3a4fcd5 mycustom/nginx:latest

After Tagging

You can verify it using:

podman images

You'll see both the original and newly tagged names pointing to the same image ID.

Notes

• Tagging does not copy or duplicate the image.

• It simply adds a new reference name to the same underlying image data.

Use Case: Preparing for Push

Before pushing an image to a registry, it's common to tag it:

podman tag myapp localhost:5000/myapp:v1

podman push localhost:5000/myapp:v1

5.Podman Push :
The podman push command is used to upload a local image from your machine to a remote container registry,
such as:

• Docker Hub

• Quay.io

• Local/private registry (e.g., localhost:5000)

• Red Hat registry (registry.access.redhat.com)

• Amazon ECR, Azure Container Registry, etc.

Basic Syntax

podman push [OPTIONS] SOURCE_IMAGE [DESTINATION]

• SOURCE_IMAGE: Name or ID of your local image

• DESTINATION (optional): Remote image name (including registry). If omitted, Podman uses the
SOURCE_IMAGE name.

Common Options

Option Description

--tls-verify Verify TLS certificates when pushing to a registry (default: true)

--authfile Path to the authentication file

6
EX_188_Images related commands
Option Description

--creds Username and password in user:password format

--format Image format: oci or docker

--quiet Suppress output

Examples

Push to Docker Hub

podman tag myapp docker.io/yourusername/myapp:v1

podman push docker.io/yourusername/myapp:v1

Podman will prompt for Docker Hub credentials unless already logged in.

Push to a private registry (e.g., running locally)

podman tag myapp localhost:5000/myapp:v1

podman push localhost:5000/myapp:v1

Push without TLS verification (e.g., for insecure registries)

podman push --tls-verify=false localhost:5000/myapp:v1

Push with specific credentials

podman push --creds user:password docker.io/yourusername/myapp:v1

Authentication

You can log in beforehand using:

podman login docker.io

This stores credentials in the default auth file (~/.config/containers/auth.json).

OCI vs Docker format

Use --format to choose image format:

podman push --format docker myapp docker.io/yourusername/myapp:dockerformat

After pushing

You can verify the image is on the remote registry (e.g., through Docker Hub UI or by pulling it from another
machine).

Let's break down the command:

podman push docker.io/yourusername/myapp:v1

This command pushes a local image to the Docker Hub registry, under your Docker Hub account.

7
EX_188_Images related commands

Detailed Breakdown

Part Meaning

podman push Tells Podman to push (upload) an image

docker.io The registry name — docker.io refers to Docker Hub

Yourusername Your Docker Hub username or organization

Myapp The repository name (project name) on Docker Hub

:v1 The tag of the image (like a version label)

6.Podman rmi :

The podman rmi command is used to remove one or more local images from your system.

Basic Syntax

podman rmi [OPTIONS] IMAGE [IMAGE...]

• IMAGE: The image name, tag, or ID to remove.

Common Options

Option Description

-f, --force Force removal of the image even if it's being used by a container

--no-prune Do not remove untagged parent images

Examples

Remove an image by name

podman rmi ubuntu

Remove by name and tag

podman rmi docker.io/library/ubuntu:latest

Remove an image by ID

podman images # First find the image ID

8
EX_188_Images related commands
podman rmi 3f2f48ecac65

Force remove an image (used by a container)

podman rmi -f myimage

Remove multiple images at once

podman rmi image1 image2 image3

Errors You Might See

1. Image is being used by a container

Error: image is being used by a container

Use --force if you want to delete it anyway:

podman rmi -f myimage

2. Image not found

Error: no such image

Check with podman images and use the exact tag or ID.

Tip: Clean Up All Unused Images

To remove all dangling images (not used by any containers):

podman image prune

You might also like