Red Hat Certified Specialist in Containers Free Sample Questions

Description

Covers building container images with Podman and a Containerfile, managing private registries and image tags, running and logging containers, multi-container application stacks, and troubleshooting.

12 free sample questions160 in the full practice test

Try simulator

EX188 Sample Questions

  1. Question 1

    Intermediate

    Implement Images Using Podman and Containerfile · Specify the Container Base Image

    You are a Cloud Architect designing a containerized application build process for a financial institution. You need to create a Containerfile that compiles a Go application from source and then packages the binary into a minimal runtime image to reduce the attack surface and image size. The build requires several dependencies that are not needed in production. Which strategy should you implement to satisfy these requirements?

    Answer and explanation

    Correct answer: C

    Multi-stage builds allow you to use a heavy image with compilers for the build phase and copy only the necessary artifacts (the binary) to a separate, minimal runtime image. This significantly reduces the final image size and removes build tools that could be security risks.

  2. Question 2

    Intermediate

    Implement Images Using Podman and Containerfile · Add Content and Configure Runtime Environment

    A DevOps engineer is optimizing a Containerfile for a Python application. The application source code changes frequently, but the dependencies (requirements.txt) change rarely. The current Containerfile rebuilds all dependencies every time the code changes. How should the engineer restructure the Containerfile to maximize build cache efficiency?

    flowchart TD Start([Start Build]) --> Layer1[Base Image] Layer1 --> Layer2[Install Sys Deps] Layer2 --> Layer3[?] Layer3 --> Layer4[?] Layer4 --> Layer5[CMD Run App]
    Answer and explanation

    Correct answer: B

    By copying only the requirements file first and installing dependencies, Podman can cache the RUN pip install layer. If requirements.txt hasn't changed, this cached layer is reused even if the source code (copied in a later step) has changed.

  3. Question 3

    Beginner

    Implement Images Using Podman and Containerfile · Configure Container Runtime Environment

    You are writing a Containerfile for a web server that must not run as the root user for security compliance. You have created a user named webuser with ID 1001. Which instruction sequence correctly configures the container to run as this user?

    Answer and explanation

    Correct answer: A

    The RUN instruction executes the command to create the user in the build phase. The USER instruction then switches the context so that all subsequent instructions (like CMD or ENTRYPOINT) and the running container itself execute as webuser.

  4. Question 4

    Beginner

    Implement Images Using Podman and Containerfile · Add Content and Configure Runtime Environment

    A security audit requires that a specific directory /opt/app/data in your container image be pre-populated with data from a tarball named assets.tar.gz. The archive is located in the build context. You want the archive to be automatically extracted into the destination directory inside the image. Which Containerfile instruction should you use?

    Answer and explanation

    Correct answer: C

    The ADD instruction has special functionality compared to COPY. When the source is a local tar archive (identity, gzip, bzip2, or xz), ADD automatically unpacks it into the destination directory. COPY would just place the compressed file there.

  5. Question 5

    Intermediate

    Implement Images Using Podman and Containerfile · Container Volumes and Host Data Sharing

    You are creating a custom database container that needs to initialize a data directory at runtime. You want to ensure that if the user mounts a host directory to /var/lib/db, the appropriate SELinux context is applied so the container can write to it. Which Containerfile instruction defines this mount point to inform container runtimes of its purpose?

    Answer and explanation

    Correct answer: C

    The VOLUME instruction creates a mount point with the specified name and marks it as holding externally mounted volumes from native host or other containers. While the actual SELinux relabeling (z/Z) happens at runtime via the -v flag, declaring VOLUME ensures the directory exists and has correct permissions within the image structure for data persistence.

  6. Question 6

    Intermediate

    Implement Images Using Podman and Containerfile · Pass Environment Variables and Arguments

    A developer is building a container that needs to accept a configuration value at build time to select a specific software version, but this value should NOT persist as an environment variable in the final running container. Which instruction should be used?

    Answer and explanation

    Correct answer: D

    ARG instructions define variables that are only available during the build process (e.g., to be used in RUN instructions). Unlike ENV, ARG values are not persisted in the final image as environment variables for the running container.

Register free for 6 more questions

Or unlock all 160 EX188 questions with explanations, timed mode and flashcards.