QuizLander
← All public quizzes

Docker Fundamentals — Practice

by Jude · 14/05/2026 · 217 views · 0 shares

Practice questions on Docker images, containers, networks, volumes, Dockerfiles, and Compose. Original wording.
12
Questions
🇬🇧 English
Language
Medium
Difficulty
Start the quiz (as a guest or with an account)
Share as image

Questions in this quiz

  1. 1. What is the difference between an image and a container?
    1. They are the same thing
    2. An image is a read-only template; a container is a running (or stopped) instance of an image with a writable layer
    3. An image runs; a container is the source code
    4. A container is an image with no filesystem
  2. 2. Which Dockerfile instruction sets the working directory inside the image?
    1. CD
    2. WORKDIR
    3. ENV
    4. RUN cd
  3. 3. What does docker exec -it <container> sh do?
    1. Starts a new container
    2. Opens an interactive shell in an already-running container
    3. Builds an image
    4. Stops the container
  4. 4. Which Docker network driver lets containers communicate by container name on a user-defined network?
    1. host
    2. bridge (user-defined)
    3. none
    4. macvlan
  5. 5. What persists across container restarts and removals if attached correctly?
    1. The container's writable layer
    2. A named volume mounted via -v or --mount
    3. An environment variable
    4. A tag on the image
  6. 6. Which Dockerfile instruction copies files from the build context into the image with no special parsing of URLs or archives?
    1. ADD
    2. COPY
    3. INSERT
    4. PUT
  7. 7. Why use a multi-stage Docker build?
    1. To split images across multiple machines
    2. To use build-time dependencies in a builder stage and produce a smaller runtime image
    3. To run multiple containers from one Dockerfile
    4. To enable layer encryption
  8. 8. Which command tags an existing local image app:latest as registry.example.com/app:1.2?
    1. docker rename app:latest registry.example.com/app:1.2
    2. docker tag app:latest registry.example.com/app:1.2
    3. docker mv app:latest registry.example.com/app:1.2
    4. docker push --tag registry.example.com/app:1.2
  9. 9. Which Compose feature lets multiple services share a private network without exposing ports to the host?
    1. The default network created for a Compose project
    2. Bind mounts
    3. secrets:
    4. depends_on:
  10. 10. Which instruction in a Dockerfile defines the default command run when the container starts?
    1. RUN
    2. CMD
    3. ENTRYPOINT (or CMD; ENTRYPOINT is the canonical executable, CMD is the default args)
    4. EXEC
  11. 11. Which command removes all stopped containers, unused networks, dangling images, and build cache?
    1. docker rm -a
    2. docker system prune
    3. docker clean
    4. docker rmi --all
  12. 12. What does the EXPOSE 8080 instruction do?
    1. Publishes port 8080 on the host automatically
    2. Documents the port the container listens on; it does not actually publish it
    3. Opens the firewall on the host
    4. Forces TLS on port 8080
Answer the questions and see my score

Comments

Sign in to comment.

Loading…