Docker Basics Quiz
← Back to Quiz Home
Welcome! 🐳
Test your fundamental Docker knowledge with this quick quiz.
Instructions :
Select the best answer for each question.
Your score will be shown at the end.
Aim for 100% to prove you are ready for the next level!
Which command is used to run a container from an image?
docker run creates and starts a container in one go. docker start is used to start an existing stopped container.
A Docker Image is an immutable (read-only) template with source code, libraries, and dependencies required to run an application.
Which file is used to build a Docker image?
A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image.
Which command lists all running containers?
docker ps lists running containers. Use docker ps -a to see all containers (including stopped ones).
How do you stop a running container?
docker stop gracefully stops the container. docker kill forces it to stop immediately.
Which command downloads an image from a registry?
docker pull downloads a Docker image from a registry (like Docker Hub).
What does the -d flag do in docker run -d nginx?
-d stands for "detached". It runs the container in the background and prints the container ID.
Which command removes a stopped container?
docker rm removes containers. docker rmi removes images.
Which instruction in a Dockerfile sets the base image?
FROM initializes a new build stage and sets the Base Image for subsequent instructions.
Where are Docker images usually stored?
Images are stored in a Registry. Docker Hub is the default public registry.
Which command builds an image from a Dockerfile in the current directory?
docker build builds an image from a Dockerfile. The . specifies the build context (current directory).
What is the default name of the Docker configuration file that defines a multi-container application?
docker-compose.yml is the default file used by Docker Compose.
Which command is used to view the logs of a container?
docker logs fetches the logs of a container.
What does the -v flag do in docker run?
-v or --volume is used to mount a volume (bind mount or named volume) to the container.
Which command lists all locally available images?
docker images (or docker image ls) lists the images stored locally.
How can you execute a command inside a running container?
docker exec runs a new command in a running container. -it allows interactive access.
What is a Docker Registry?
A Docker Registry is a stateless, highly scalable server side application that stores and lets you distribute Docker images.
Which command removes an image?
docker rmi (remove image) deletes an image from the local store.
What is the purpose of the EXPOSE instruction in a Dockerfile?
EXPOSE functions as a type of documentation between the person who builds the image and the person who runs the container. It does not actually publish the port.
Which flag automates the cleanup of the container after it exits?
The --rm flag automatically removes the container when it exits.
Quiz Progress
0 / 0 questions answered
(0% )
0 correct
Quiz Complete!
0%
Reset quiz
📚 Study Guides
📬 Weekly DevOps, Cloud & Gen AI quizzes & guides