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.
Start practicing
Container Image Building — choose a session length
Free · No account required
Domain overview
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.
Exam objectives
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
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
Click any question to see the full explanation and answer options, or start a focused practice session above.
When writing a Containerfile, which instruction specifies the base image to be used for the subsequent build steps?
2Which instruction documents the network ports on which a container listens at runtime?
3A 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?
4You 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?
5Which instruction should be used in a Containerfile to copy local files from the host machine into the container filesystem?
6Which Containerfile instruction sets the working directory for any subsequent RUN, CMD, ENTRYPOINT, COPY, and ADD instructions?
7Which user instruction changes the user name or UID and group name or GID to use when running subsequent instructions in the Containerfile?
8You 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?
9An administrator needs to execute multiple commands in a single RUN instruction to minimize image layers. Which syntax is standard in a Containerfile?
10You 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?
11A 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?
12What is the primary benefit of utilizing multi-stage builds in Containerfiles?
13When writing a Containerfile, what is the difference between shell form and exec form for the CMD instruction?
14You 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?
15A 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?
16You 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?
17When using the ADD instruction with a remote URL source, what is a recommended best practice regarding security and layer efficiency?
18How does Podman's rootless build architecture handle volume mounts or privileged operations specified within a RUN instruction in a Containerfile?
19You 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?
20A 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?
21You 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?
22Which TWO instructions in a Containerfile can be used to set metadata or default execution parameters that influence how a container runs? (Choose two.)
23You 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?
24Which TWO Containerfile instructions are used to bring files or data from outside the container into the build context or image? (Choose two.)
25Which TWO commands can be used with Podman to build a container image from a Containerfile? (Choose two.)
26Which TWO options are valid flags for the 'podman build' command to specify build arguments and tags? (Choose two.)
27Which TWO statements are true regarding the EXPOSE instruction in a Containerfile? (Choose two.)
28Which TWO instructions are used to define variables or set environment values within a Containerfile? (Choose two.)
29Which THREE practices should be followed to optimize container image size and build caching when writing Containerfiles? (Choose three.)
30Which THREE features or characteristics distinguish the ADD instruction from the COPY instruction in a Containerfile? (Choose three.)
31Which THREE directives or practices are associated with implementing secure container builds and adhering to least-privilege principles? (Choose three.)
32Which THREE behaviors occur when utilizing multi-stage builds in a Containerfile? (Choose three.)
33Which THREE statements accurately describe the differences between shell form and exec form for CMD and ENTRYPOINT instructions? (Choose three.)
34Which THREE practices should be observed when managing environment variables (ENV vs ARG) in Containerfiles for secure and efficient builds? (Choose three.)
35You 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?
36An 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?
37You 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?
38By 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?
39You 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?
40You 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?
41You 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?
42An auditor reviewing your Containerfile notices an EXPOSE instruction for port 80. What is the primary function of the EXPOSE instruction?
43You are optimizing a Containerfile using multi-stage builds to minimize image size. What is the key advantage of a multi-stage build in Podman?
44Which TWO of the following instructions in a Containerfile can be written using either the shell form or the exec form?
45Which THREE practices are recommended when optimizing cache utilization during image builds with podman build?
46Which TWO instructions can be used to copy files or directories from a build context into a container image?
47Which THREE statements correctly describe the differences between CMD and ENTRYPOINT in a Containerfile?
48You 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?
49You 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.)
50A 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?
51You 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?
52A 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?
53You 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.)
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.
The Courseiva EX188 question bank contains 53 questions in the Container Image Building domain. Click any question to see the full explanation and answer breakdown.
Start with a 10-question focused session to identify your baseline accuracy in this domain. Read every explanation — even for questions you answer correctly — to understand the reasoning. Once you score consistently above 80%, move to a 20–30 question session to confirm depth before moving to the next domain.
Yes — the session launcher on this page draws questions exclusively from the Container Image Building domain. Choose 10, 20, 30, or 50 questions for a focused session, or click individual questions to review them one by one.
Save your results, see per-domain analytics, and get readiness scores — free, for every certification.
Sign Up FreeFree forever · Every certification included