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