W3Reference.com
Toggle Menu
Home
Online Rust Compiler
Tutorials
Python Tutorial
Java Tutorial
Rust Tutorial
TypeScript Tutorial
ReactJS Tutorial
HTML & CSS Basics
Docker Containers Guide
Kubernetes Tutorial
Software Design Patterns
Blog
All Posts
Working with Docker Images and Containers
Assess your ability to build,manage,and run Docker images and containers.
1. Which Docker command is used to build an image from a Dockerfile?
docker build
docker create
docker run
docker pull
2. What is the primary difference between a Docker image and a container?
Images are read-only templates; containers are runnable instances
Images are temporary; containers are permanent
Images require a network; containers do not
Images are for Linux only; containers work on any OS
3. Which Dockerfile instruction sets a command that can be overridden at runtime?
ENTRYPOINT
CMD
RUN
FROM
4. What does the '-d' flag do in 'docker run'?
Runs the container in detached mode (background)
Deletes the container after it exits
Debugs the container
Downloads the image before running
5. Which command lists all Docker images stored locally?
docker images
docker ps
docker container ls
docker pull
6. What is the purpose of the 'FROM' instruction in a Dockerfile?
Sets the working directory
Specifies the base image
Runs a command during build
Exposes a port
7. Which command stops a running Docker container gracefully?
docker stop
docker kill
docker pause
docker rm
8. What is a Docker image layer?
A running container instance
A read-only filesystem snapshot
A network configuration
A volume mount point
9. Which commands list Docker containers (select all that apply)?
docker ps
docker container ls
docker images
docker ps -a
docker container list
10. Which Dockerfile instructions create new image layers (select all that apply)?
FROM
RUN
COPY
CMD
WORKDIR
11. Which commands remove a Docker container (select all that apply)?
docker rm <container_id>
docker container remove <container_id>
docker delete <container_id>
docker rmi <container_id>
docker container rm <container_id>
12. What are benefits of Docker containers (select all that apply)?
Consistent environments across development/production
Isolation of applications and dependencies
Automatic scaling of applications
Reduced resource usage vs. virtual machines
Native support for Windows applications only
13. Which are true about Docker Hub (select all that apply)?
Public registry for Docker images
Requires a paid subscription to use
Users can push their own images
Only hosts official images
Default registry for image pulls
14. A Docker container can be restarted after being stopped.
True
False
15. The 'docker pull' command downloads an image from a registry to the local machine.
True
False
16. The 'ADD' Dockerfile instruction is identical to 'COPY' with no extra functionality.
True
False
17. Docker containers share the host operating system's kernel.
True
False
18. What command displays logs of a running Docker container (abbrev. allowed)?
19. Name the Dockerfile instruction that documents which port a container listens on.
20. What term describes persistent storage for Docker containers outside their filesystem?
Reset
Answered 0 of 0 — 0 correct