Home › CKAD › Topics › Practice tasks › Container Image Management
CKAD · Application Design and Build

Build an Image with Podman and Save It as a Tarball

On the node, directory /root/app-source contains a valid Dockerfile.

Check live lab access → All CKAD tasks

Live lab access

This task description is public. Live practice requires full access unless this is the selected free weekly task. AI Lab Coach is available in single-task labs, including the free weekly task. See this week's free task.

Create an account to continue →

Read this week's free task →

On a phone? Read the task and create your account here, then sign in on a desktop or laptop for the terminal lab. Nothing starts until you choose Start.

The task

Task

On the node, directory /root/app-source contains a valid Dockerfile.

Requirements

  1. Build a container image using Podman with name my-app:1.0 using /root/app-source as build context
  2. Save the image as a tarball to /root/my-app.tar

Note: The exam environment typically uses Podman, but Docker commands are nearly identical.

Original Prepium guide · Written for Kubernetes v1.35 and checked against the official documentation on 6 October 2026. Use a disposable practice cluster. The commands here run on a Linux machine with Podman installed, not inside a Pod; use a throwaway VM or practice node rather than a shared host.

Build an OCI image with Podman, then move it as a tar archive

An image is a stack of filesystem layers plus a small JSON configuration. podman build creates that stack from a Containerfile and a build context, and stores it in local image storage under a name. podman save serializes a stored image, layers, history and tags included, into a single archive that podman load can restore on another machine. CKAD expects you to do this quickly and to know where the name and the archive format come from.

context dir (Containerfile + files) --podman build -t--> local storage: localhost/prepium/motd:0.3
                                                            |
                                    podman save -o ... (docker-archive or oci-archive)
                                                            v
                                                 motd.tar --podman load -i--> same image again

1. Prepare a small build context

mkdir -p ~/prepium-img && cd ~/prepium-img
echo "practice makes permanent" > motd.txt
cat > Containerfile <<'EOF'
FROM docker.io/library/busybox:1.36
COPY motd.txt /motd.txt
CMD ["cat", "/motd.txt"]
EOF

The context is the directory whose files COPY can see. Podman looks for a file named exactly Containerfile or Dockerfile in it; any other filename needs -f. The base image is fully qualified (docker.io/library/...) on purpose: Podman's documentation recommends full references, because a short name such as busybox goes through short-name resolution and can stop at a prompt asking which registry to use.

2. Build and name the image

podman build -t prepium/motd:0.3 ~/prepium-img
podman images
podman run --rm localhost/prepium/motd:0.3

The last argument is the context, not the Containerfile. Because the name you gave has no registry part, Podman stores it as localhost/prepium/motd; podman images shows that in the REPOSITORY column with 0.3 under TAG. Add more names to the same image later with podman tag.

3. Save it in either archive format

podman save -o /tmp/motd-docker.tar localhost/prepium/motd:0.3
podman save --format oci-archive -o /tmp/motd-oci.tar localhost/prepium/motd:0.3
ls -lh /tmp/motd-*.tar
tar -tf /tmp/motd-oci.tar | head

Without --format, podman save writes a docker-archive, which docker load also understands. --format oci-archive writes a tar laid out to the OCI Image Format instead. Two directory formats (oci-dir, docker-dir) also exist; they produce a folder, not a tar file, so they are the wrong choice when a single archive file is wanted. Without -o, the archive goes to standard output, which is why you sometimes see podman save IMAGE > file.tar.

4. Prove the round trip

podman rmi localhost/prepium/motd:0.3
podman load -i /tmp/motd-docker.tar
podman images --filter reference=localhost/prepium/motd

podman load prints a Loaded image: line naming what it restored, and the image is back with its original name and tag. That is the real test of an archive: it loads cleanly and the image runs.

Common mistakes

Example checkEvidence
Image exists with the requested namepodman images REPOSITORY and TAG
Archive is a real filels -l shows a non-trivial size; tar -tf lists entries
Archive is usablepodman load -i reports the expected image name
Image behavespodman run --rm prints the expected output

Cleanup: podman rmi localhost/prepium/motd:0.3, rm -rf ~/prepium-img /tmp/motd-*.tar. References: podman build, podman save, podman load. Next, try fixing a broken Deployment.

Exam
CKAD
Domain
Application Design and Build
Grading
Programmatic · partial credit

What this tests

Define pods and multi-container patterns, build container images, and run jobs and cronjobs. On the CKAD exam, Application Design and Build tasks are graded purely on what you build in the cluster - not multiple choice - so the only way to get faster is to do them on a real cluster against a clock.

Practice it for real

The public description lets you study the task before signing up. Full access includes this live lab; the selected Task of the Week is free with an account. You solve the task in a real terminal, hit validate, and a programmatic checker scores exactly what you got right and wrong (with partial credit). You can open the solution while practising, then retry and use the failed checks to improve your score.

Related CKAD tasks