Courseiva

EX188 · domain

Container Image Building

This domain covers authoring Containerfiles to build OCI images with Podman and Buildah. You are tested on choosing instructions correctly, layering and caching behavior, passing build arguments, setting runtime defaults, and keeping images small and reproducible through practical build-and-inspect tasks.

53 questions17 easy19 medium17 hard

Focused practice

Practice Container Image Building questions

Scored sessions drawing only from this domain — pick a length below.

Start 20-question practice test →

What this domain covers

What to know about Container Image Building

Build working images from a Containerfile: pick the right instructions, order steps for cache reuse, pass build arguments, and set ENTRYPOINT with overridable CMD defaults. The key is understanding layer caching and keeping cleanup in the same RUN instruction that created the files.

Selecting Containerfile instructions such as FROM, RUN, COPY, ENV, ENTRYPOINT, CMD, and LABEL correctly

Using podman build with tags, build arguments, and alternate Containerfile paths

Understanding layer caching so unchanged instructions and copied files are reused

Reducing image size by cleaning package manager caches inside the same RUN step

Watch out for

Common Container Image Building exam traps

  • ▸Confusing CMD and ENTRYPOINT: CMD supplies overridable default arguments, while ENTRYPOINT sets the executable that receives them
  • ▸Copying the whole build context before installing dependencies, which invalidates the cache whenever any unrelated file changes
  • ▸Running a package install in one RUN and cache cleanup in a later RUN, so the removed files still occupy an earlier layer

Question index

All Container Image Building questions (53)

Click any question to see the full explanation, or start a practice session above.

1

An administrator needs to execute multiple commands in a single RUN instruction to minimize image layers. Which syntax is standard in a Containerfile?

Medium
2

Which TWO commands can be used with Podman to build a container image from a Containerfile? (Choose two.)

Easy
3

You need to set a persistent environment variable named 'APP_PORT' with the value '8080' inside a container image via the Containerfile. Which instruction should you use?

Easy
4

You are building an image behind a corporate firewall that requires a custom Certificate Authority (CA) certificate to trust internal registries and repositories. How can you add this CA certificate to the build container?

Medium
5

You are building a minimal container image from scratch using 'FROM scratch'. Your statically compiled Go binary fails to execute when the container starts, with a 'file not found' error, even though it was successfully copied into the image. What is the most likely cause?

Hard
6

What is the primary benefit of utilizing multi-stage builds in Containerfiles?

Medium
7

Which TWO instructions can be used to copy files or directories from a build context into a container image?

Medium
8

Which THREE statements correctly describe the differences between CMD and ENTRYPOINT in a Containerfile?

Hard
9

Which TWO of the following instructions in a Containerfile can be written using either the shell form or the exec form?

Medium
10

You are reviewing a Containerfile for a web application. The Containerfile currently uses the shell form for its ENTRYPOINT instruction. You want to ensure that the application receives signals correctly and that arguments passed to `podman run` are properly forwarded to the application. Which TWO changes should you make? (Choose two.)

Medium
11

Which instruction documents the network ports on which a container listens at runtime?

Easy
12

Which THREE practices should be observed when managing environment variables (ENV vs ARG) in Containerfiles for secure and efficient builds? (Choose three.)

Hard
13

Which THREE directives or practices are associated with implementing secure container builds and adhering to least-privilege principles? (Choose three.)

Medium
14

You are optimizing a Containerfile using multi-stage builds to minimize image size. What is the key advantage of a multi-stage build in Podman?

Hard
15

When using the ADD instruction with a remote URL source, what is a recommended best practice regarding security and layer efficiency?

Hard
16

You want to set the working directory for any subsequent RUN, CMD, ENTRYPOINT, COPY, and ADD instructions that follow it in the Containerfile. Which instruction achieves this?

Easy
17

You need to ensure that a container image built with Podman includes reproducible timestamps for files to improve security and supply chain verification. Which flag or environment variable controls this?

Hard
18

Which THREE behaviors occur when utilizing multi-stage builds in a Containerfile? (Choose three.)

Hard
19

Which TWO instructions are used to define variables or set environment values within a Containerfile? (Choose two.)

Easy
20

You are writing a Containerfile to build a custom application image using podman build. Which instruction should you use as the mandatory first non-comment instruction to define the base image?

Easy
21

You need to define a persistent environment variable named 'PORT' with the value '8080' that is available during both the build process and when running containers from the resulting image. Which instruction should you use?

Easy
22

Which instruction should be used in a Containerfile to copy local files from the host machine into the container filesystem?

Easy
23

A developer builds a custom image with `podman build -t app:v1 .` but repeatedly gets stale results because an earlier RUN layer that installs packages is cached, even though the repository metadata has changed. The developer wants to force podman to ignore all cached layers for the next build without deleting the local image or build cache. Which command accomplishes this?

Medium
24

Which THREE practices should be followed to optimize container image size and build caching when writing Containerfiles? (Choose three.)

Medium
25

You are building an image with a multi-stage Containerfile. The final stage uses `FROM registry.access.redhat.com/ubi9/ubi-minimal` and you want to copy only the compiled binary from a builder stage named `builder` into `/usr/local/bin/app`. Which Containerfile line correctly copies that artifact?

Hard
26

Which THREE statements accurately describe the differences between shell form and exec form for CMD and ENTRYPOINT instructions? (Choose three.)

Hard
27

You are using a multi-stage build in your Containerfile. How do you copy a compiled binary named 'app' from a build stage named 'builder' into your final production runtime stage?

Medium
28

You are optimizing a Containerfile for a Python application. The build currently uses a single RUN instruction that installs dependencies, runs tests, and cleans up temporary files. You want to leverage build caching to speed up rebuilds when only application code changes, while ensuring that dependency installation is cached separately. Which approach best achieves this?

Hard
29

Which TWO Containerfile instructions are used to bring files or data from outside the container into the build context or image? (Choose two.)

Easy
30

You are designing a container image that runs an executable web server. You want to provide default arguments to the executable that can be easily overridden by a user passing arguments directly to 'podman run'. Which instruction combination is best?

Hard
31

Which Containerfile instruction sets the working directory for any subsequent RUN, CMD, ENTRYPOINT, COPY, and ADD instructions?

Easy
32

Which user instruction changes the user name or UID and group name or GID to use when running subsequent instructions in the Containerfile?

Easy
33

By default, podman build executes build instructions using the root user. You want to switch the execution context to a non-privileged user named 'appuser' for all subsequent RUN, CMD, and ENTRYPOINT instructions. Which instruction should you use?

Medium
34

Which THREE features or characteristics distinguish the ADD instruction from the COPY instruction in a Containerfile? (Choose three.)

Medium
35

Which TWO statements are true regarding the EXPOSE instruction in a Containerfile? (Choose two.)

Easy
36

You are writing a Containerfile for a Python web service. You want the image build to install dependencies and then run the service with predictable behavior across environments. Which TWO practices correctly apply build-time and runtime configuration in the Containerfile? (Choose two.)

Hard
37

How does Podman's rootless build architecture handle volume mounts or privileged operations specified within a RUN instruction in a Containerfile?

Hard
38

Which TWO instructions in a Containerfile can be used to set metadata or default execution parameters that influence how a container runs? (Choose two.)

Easy
39

When writing a Containerfile, which instruction specifies the base image to be used for the subsequent build steps?

Easy
40

A developer wants to build a container image using podman build, but the Containerfile is named 'Customfile' and located in a subdirectory named 'dockerfiles'. Which command accomplishes this?

Easy
41

You are optimizing image build times and notice that a specific RUN instruction fetching dependencies is re-running on every build, even though the requirements.txt file has not changed. What is causing this behavior?

Hard
42

An administrator needs to execute a package update and install dependencies during the podman build process, ensuring these commands are committed as a new layer in the final image. Which instruction accomplishes this?

Medium
43

You want to build an image that has a build-time argument named 'VERSION'. How do you declare this variable inside the Containerfile so it can be used during the build steps?

Medium
44

When writing a Containerfile, what is the difference between shell form and exec form for the CMD instruction?

Medium
45

A developer needs to optimize image size by removing build caches and temporary package manager cache files within the same RUN instruction. Why must this be done in a single RUN instruction?

Medium
46

Which THREE practices are recommended when optimizing cache utilization during image builds with podman build?

Hard
47

You need to ensure that a file copied into your image via the COPY instruction is owned by a specific user 'developer' and group 'devgroup'. How can this be achieved efficiently?

Medium
48

A team wants to document ownership and contact information directly in the image so that `podman inspect` shows who maintains it. Which Containerfile instruction should they add to set this metadata?

Easy
49

A developer has written a Containerfile with multiple COPY instructions for static configuration files that change frequently, placed near the top of the Containerfile before the application code installation. Why is this considered a bad practice for build caching?

Medium
50

You need to copy local application source code from your build context into the /app directory inside the container image, automatically unpacking it if it is a local tar archive. Which instruction should you select?

Hard
51

Which TWO options are valid flags for the 'podman build' command to specify build arguments and tags? (Choose two.)

Easy
52

An auditor reviewing your Containerfile notices an EXPOSE instruction for port 80. What is the primary function of the EXPOSE instruction?

Medium
53

A developer wants to pass a secret API key during the container build process without leaving the secret exposed in image layers or history. Which Podman feature should be used?

Hard

Frequently asked questions

What does the Container Image Building domain cover on the EX188 exam?
Build working images from a Containerfile: pick the right instructions, order steps for cache reuse, pass build arguments, and set ENTRYPOINT with overridable CMD defaults. The key is understanding layer caching and keeping cleanup in the same RUN instruction that created the files.
How many questions are in this domain?
This page lists all 53 Container Image Building questions in the EX188 question bank. The actual exam draws from this domain proportionally to its weighting in the official exam blueprint.
What is the best way to practise this domain?
Start with a short focused session (10 questions) to identify gaps, then work through explanations. Repeat with a longer session once the weak areas feel solid.
Can I practise only Container Image Building questions?
Yes — the session launcher on this page filters questions to this domain only. Choose any session length for inline explanations and scoring.
Red Hat Certified Specialist in Containers (EX188, Podman-based) (EX188) Container Image Building Practice Questions