Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 2 MCQs Image Building & Container Management

INT332 — Devops Virtualization And Configuration Management 60 questions. Pick an option to check it.

Read the notes

0 of 60 answered 0 right 0 wrong , 60 left

  1. Question 1 of 60 Docker file Core Concepts: Basic instructions ( FROM, RUN, COPY, ADD, CMD, ENTRYPOINT, WORKDIR, ENV, EXPOSE, VOLUME etc) Easy

    Which Dockerfile instruction is used to set the base image for subsequent instructions?

  2. Question 2 of 60 Docker file Core Concepts: Basic instructions ( FROM, RUN, COPY, ADD, CMD, ENTRYPOINT, WORKDIR, ENV, EXPOSE, VOLUME etc) Easy

    Which instruction sets the working directory for any RUN, CMD, ENTRYPOINT, COPY, and ADD instructions that follow it in the Dockerfile?

  3. Question 3 of 60 Docker file Core Concepts: Basic instructions ( FROM, RUN, COPY, ADD, CMD, ENTRYPOINT, WORKDIR, ENV, EXPOSE, VOLUME etc) Easy

    How do you define environment variables inside a Dockerfile?

  4. Question 4 of 60 Docker file Core Concepts: Build context & .dockerignore Easy

    Which file is used to exclude files and directories from being sent to the Docker daemon as part of the build context?

  5. Question 5 of 60 Image Creation in Detail: docker build process Easy

    What is the primary command used to build a Docker image from a Dockerfile?

  6. Question 6 of 60 Docker file Core Concepts: Image layering Easy

    In Docker, what is created every time a RUN, COPY, or ADD instruction is executed in a Dockerfile?

  7. Question 7 of 60 Image Creation in Detail: Images Tagging /versioning Easy

    Which flag is used with the docker build command to name and optionally tag an image?

  8. Question 8 of 60 Image Creation in Detail: Inspecting images (history, layers) Easy

    Which command allows you to see the intermediate layers and creation steps of a Docker image?

  9. Question 9 of 60 Docker Networking: Bridge network Easy

    What is the default network driver for newly created standalone Docker containers?

  10. Question 10 of 60 Docker Networking: Host & overlay networks Easy

    Which Docker network driver is primarily used to connect multiple Docker daemons together, allowing swarm services to communicate?

  11. Question 11 of 60 Docker Networking: Port mapping between host and container Easy

    Which flag is used in the docker run command to map a port on the host machine to a port inside the container?

  12. Question 12 of 60 Docker Storage: Volumes vs bind mounts Easy

    Which Docker storage option is completely managed by Docker and is the preferred way to persist data?

  13. Question 13 of 60 Docker Storage: Volumes vs bind mounts Easy

    Which storage mechanism relies on the directory structure of the host machine by mounting a specific host path into a container?

  14. Question 14 of 60 Docker Storage: Copy-on-write mechanism Easy

    What strategy does Docker use to share image layers and maximize storage efficiency when running containers?

  15. Question 15 of 60 Registries: Docker Hub Easy

    What is the name of the default public registry where Docker looks for images if no custom registry URL is provided?

  16. Question 16 of 60 Registries: Authentication & access tokens Easy

    Which command is used to authenticate and log in to a Docker registry?

  17. Question 17 of 60 Docker file Core Concepts: Basic instructions ( FROM, RUN, COPY, ADD, CMD, ENTRYPOINT, WORKDIR, ENV, EXPOSE, VOLUME etc) Easy

    Which Dockerfile instruction functions as documentation to inform users about the network ports the container will listen on at runtime?

  18. Question 18 of 60 Docker file Core Concepts: Basic instructions ( FROM, RUN, COPY, ADD, CMD, ENTRYPOINT, WORKDIR, ENV, EXPOSE, VOLUME etc) Easy

    What is the primary difference between the COPY and ADD instructions in a Dockerfile?

  19. Question 19 of 60 Docker Networking: DNS inside Docker Easy

    How do containers running on the same custom user-defined bridge network resolve each other's IP addresses?

  20. Question 20 of 60 Docker file Core Concepts: Basic instructions ( FROM, RUN, COPY, ADD, CMD, ENTRYPOINT, WORKDIR, ENV, EXPOSE, VOLUME etc) Easy

    Which Dockerfile instruction is typically used to provide default arguments or the default executable for a running container?

  21. Question 21 of 60 Basic instructions ( FROM, RUN, COPY, ADD, CMD, ENTRYPOINT, WORKDIR, ENV, EXPOSE, VOLUME etc) Medium

    In a Dockerfile, both COPY and ADD can be used to add files to an image. In which of the following scenarios is ADD specifically required over COPY?

  22. Question 22 of 60 Basic instructions ( FROM, RUN, COPY, ADD, CMD, ENTRYPOINT, WORKDIR, ENV, EXPOSE, VOLUME etc) Medium

    A Dockerfile contains ENTRYPOINT ["python", "app.py"] and CMD ["--help"]. What happens if you run the container using the command docker run my-image --port 8080?

  23. Question 23 of 60 Build context & .dockerignore Medium

    You are building a Docker image and notice the build process is sending 2GB of data to the Docker daemon, slowing it down. The large files are in a local ./data folder that is not needed inside the image. What is the most efficient way to resolve this?

  24. Question 24 of 60 Docker Storage: Volumes vs bind mounts, backing data on host Medium

    A developer is writing code locally and wants the changes to reflect immediately inside a running container without rebuilding the image. Which storage mechanism is most appropriate?

  25. Question 25 of 60 Port mapping between host and container Medium

    You want to run a web server container and map the host's port to the container's port . Which of the following docker run flags correctly achieves this?

  26. Question 26 of 60 Copy-on-write mechanism Medium

    In Docker's storage architecture, what happens when a running container needs to modify an existing file that originated from the underlying read-only image layers?

  27. Question 27 of 60 Image layering Medium

    To optimize a Dockerfile and reduce the final image size, a developer changes three separate RUN instructions (e.g., apt-get update, apt-get install, rm -rf /var/lib/apt/lists/*) into a single RUN instruction chained with &&. Why does this reduce the image size?

  28. Question 28 of 60 Authentication & access tokens Medium

    After successfully running docker login to authenticate with a private registry, where does Docker by default store the authentication credentials or tokens on a Linux host?

  29. Question 29 of 60 Host & overlay networks Medium

    Which Docker network driver is best suited for communication between standalone containers running on different Docker daemon hosts within a Swarm cluster?

  30. Question 30 of 60 Basic instructions ( FROM, RUN, COPY, ADD, CMD, ENTRYPOINT, WORKDIR, ENV, EXPOSE, VOLUME etc) Medium

    Consider the following Dockerfile snippet:
    dockerfile
    WORKDIR /app
    WORKDIR src
    WORKDIR bin
    RUN pwd

    What will be the output of the RUN pwd command during the build process?

  31. Question 31 of 60 Inspecting images (history, layers) Medium

    You want to analyze an existing Docker image to see the exact commands that were used to build it, layer by layer, along with the size of each layer. Which command should you use?

  32. Question 32 of 60 DNS inside Docker Medium

    Two containers, web and db, are attached to the default bridge network. The web container tries to ping the db container using its name (ping db). What will happen and why?

  33. Question 33 of 60 GitHub Container Registry (GHCR) Medium

    When tagging an image to push to the GitHub Container Registry (GHCR), what is the correct prefix format required for the repository name?

  34. Question 34 of 60 Images Tagging /versioning Medium

    You have an image with the ID a1b2c3d4 tagged as myapp:v1. You execute docker tag myapp:v1 myapp:latest. What is the result regarding the image layers and storage?

  35. Question 35 of 60 Basic instructions ( FROM, RUN, COPY, ADD, CMD, ENTRYPOINT, WORKDIR, ENV, EXPOSE, VOLUME etc) Medium

    What is the primary difference between the ARG and ENV instructions in a Dockerfile?

  36. Question 36 of 60 Docker Storage: Volumes vs bind mounts, backing data on host Medium

    You need to back up the data stored in a Docker named volume called db_data. Which of the following approaches is standard practice for backing up a Docker volume?

  37. Question 37 of 60 Basic instructions ( FROM, RUN, COPY, ADD, CMD, ENTRYPOINT, WORKDIR, ENV, EXPOSE, VOLUME etc) Medium

    A developer includes the instruction EXPOSE 80 in their Dockerfile. What is the immediate effect of this instruction when a container is run from this image without any port mapping flags?

  38. Question 38 of 60 Host & overlay networks Medium

    If a container is started with the flag --network host, what happens to any port mapping instructions (like -p 8080:80) passed in the docker run command?

  39. Question 39 of 60 Private registries Medium

    When setting up a private Docker registry internally, a company uses the official registry:2 Docker image. If they do not configure TLS (HTTPS), what step must client machines take to push or pull images from this registry?

  40. Question 40 of 60 docker build process Medium

    Why is running the command docker build -t myapp:1.0 . from the root directory of a host machine (i.e., /) considered highly dangerous and inefficient?

  41. Question 41 of 60 Docker file Core Concepts: Basic instructions ( FROM, RUN, COPY, ADD, CMD, ENTRYPOINT, WORKDIR, ENV, EXPOSE, VOLUME etc) Hard

    A Dockerfile contains the following two instructions:
    ENTRYPOINT echo "Hello"
    CMD ["World"]
    What will be the output when a container is run from this image without any additional command-line arguments?

  42. Question 42 of 60 Docker file Core Concepts: Build context & .dockerignore Hard

    You execute docker build -t myapp . in a directory containing a 10GB file named data.bin. The .dockerignore file contains the line data.bin. The Dockerfile contains the instruction COPY . /app. Which of the following statements is true regarding the build process?

  43. Question 43 of 60 Docker file Core Concepts: Basic instructions ( FROM, RUN, COPY, ADD, CMD, ENTRYPOINT, WORKDIR, ENV, EXPOSE, VOLUME etc) Hard

    Consider the following Dockerfile snippet:
    dockerfile
    VOLUME /data
    RUN echo "test" > /data/test.txt

    What will be the state of /data/test.txt when a container is started from the resulting image?

  44. Question 44 of 60 Docker Storage: Volumes vs bind mounts Hard

    You mount an empty host directory to a container directory using a bind mount (-v /empty/host/dir:/app/data), and you mount an empty Docker volume to another container directory (-v my_empty_volume:/app/config). Both /app/data and /app/config already contain files in the underlying container image. What happens to the pre-existing files in both container directories?

  45. Question 45 of 60 Docker Networking: DNS inside Docker Hard

    Why can containers attached to a user-defined bridge network resolve each other by container name, while containers on the default bridge network cannot?

  46. Question 46 of 60 Docker Storage: Copy-on-write mechanism Hard

    A container is running from an image where Layer A (bottom) has file.txt (10MB) and Layer B (top) deletes file.txt. During runtime, a process in the container creates a new file.txt (5MB). How does the Union File System handle the storage size on disk for this specific sequence?

  47. Question 47 of 60 Docker file Core Concepts: Image layering Hard

    Consider a Node.js application Dockerfile. Which sequence of instructions optimally utilizes Docker's layer caching to prevent reinstalling dependencies unless package.json changes?

  48. Question 48 of 60 Image Creation in Detail: docker build process Hard

    In a multi-stage Docker build, you have three stages: builder, tester, and the final stage. You want to copy a binary from the builder stage, but you forgot to name the stage using AS builder. The builder is the first FROM instruction. How can you validly copy the binary into the final stage?

  49. Question 49 of 60 Registries: Authentication & access tokens Hard

    When a developer executes docker login to a private registry on a Linux system without configuring an external credential helper, how are the credentials stored by default?

  50. Question 50 of 60 Image Creation in Detail: Images Tagging /versioning Hard

    What is the precise definition of a 'dangling image' in Docker, and how is it typically created?

  51. Question 51 of 60 Docker Networking: Host & overlay networks Hard

    You are deploying a container on a Docker Swarm using an overlay network. You need to ensure that the data-plane traffic (payload) between containers across different nodes is encrypted. How is this achieved?

  52. Question 52 of 60 Docker Networking: Port mapping between host and container Hard

    A container runs a database listening on port 5432. You start it with docker run -p 5432:5432 my-db. You notice the database is accessible from the public internet. What is the most secure way to modify the -p flag so it is only accessible from the host machine itself?

  53. Question 53 of 60 Docker file Core Concepts: Basic instructions ( FROM, RUN, COPY, ADD, CMD, ENTRYPOINT, WORKDIR, ENV, EXPOSE, VOLUME etc) Hard

    What is a primary difference between the COPY and ADD instructions regarding remote URLs and compressed archives?

  54. Question 54 of 60 Docker file Core Concepts: Dockerfile writing Hard

    You are writing a Dockerfile and need to pass a variable that is available during the build process but should NOT persist in the final image as an environment variable to prevent leaking sensitive build tokens. Which instruction should you use?

  55. Question 55 of 60 Image Creation in Detail: Inspecting images (history, layers) Hard

    When inspecting an image with docker image history <image>, you notice several layers have <missing> listed under the IMAGE ID column. What does this indicate?

  56. Question 56 of 60 Docker Storage: backing data on host Hard

    You want to mount an NFS share directly as a Docker volume. Which of the following commands correctly creates a Docker volume backed by NFS using the local driver?

  57. Question 57 of 60 Registries: GitHub Container Registry (GHCR) Hard

    A developer wants to push an image to the GitHub Container Registry (GHCR). If their GitHub username is octocat and the image is app-backend, what is the strictly correct fully qualified image tag format they must use?

  58. Question 58 of 60 Docker Networking: Bridge network Hard

    A container needs to be completely isolated from the host network stack, have its own MAC address, and appear as a distinct physical device on the local network (e.g., pulling an IP directly from the physical router's DHCP). Which network driver MUST be used?

  59. Question 59 of 60 Docker Networking: Linking containers Hard

    In legacy Docker configurations, the --link flag was used to allow containers to communicate. What happens at the host OS level when containerA is linked to containerB using --link containerB:aliasB?

  60. Question 60 of 60 Docker file Core Concepts: Image layering Hard

    Assume a Docker image has 5 layers. A container is spawned from this image. The application inside the container attempts to read a file located in the 3rd layer (counting from the bottom). How does the storage driver resolve this read operation?

That's unit 2

Answer a few questions and your score shows up here.