General Docker V
1.
How can you inspect the details of a Docker volume?
docker show volume
docker inspect volume
docker volume inspect
docker details volume
2.
How can you remove all stopped Docker containers?
docker container prune
docker cleanup
docker rm -v $(docker ps -q -f status=exited)
docker stop --remove-all
3.
How can you set an environment variable in a Dockerfile?
SET instruction
ENV instruction
VAR instruction
EXPORT instruction
4.
How do you remove all unused Docker volumes?
docker remove -v $(docker volume ls -qf dangling=true)
docker cleanup volumes
docker volume prune
docker delete volumes
5.
What does the 'docker system prune' command do?
Removes all unused objects
Lists all Docker objects
Deletes all containers, images, and volumes
Cleans up the Docker system
6.
What is Docker Compose used for?
To manage Docker volumes
To create Docker images
To define and run multi-container applications
To configure Docker networking
7.
What is the purpose of the 'COPY' instruction in a Dockerfile?
To expose ports for inter-container communication
To specify the working directory
To define the base image
To copy files from the host to the image during the build
8.
What is the primary function of a Docker Swarm node?
To control the overall state of the Swarm
To store Docker images
To act as a manager
To run application containers
9.
What is the purpose of the '--restart' option when running a Docker container?
To stop the container after a specific time
To restart the container automatically
To specify the container's network mode
To expose the container to the host network
10.
What does the 'EXPOSE' instruction do in a Dockerfile?
Exposes environment variables
Defines which ports the container will listen on
Specifies the container's entry point
Creates a network bridge
11.
What is the difference between the 'COPY' and 'ADD' instructions in a Dockerfile?
COPY is used for copying files, and ADD can handle URLs and unpack compressed files
ADD is used for copying files, and COPY is used for adding files from URLs
They are interchangeable and serve the same purpose
ADD is used for copying files, and COPY is used for adding files from URLs
12.
How do you check the Docker version installed on your system?
docker --version
docker version
docker show version
docker info
13.
What does the 'docker ps' command display?
All containers, including stopped ones
Running containers
Images on the local machine
Logs of running containers
14.
How can you run a command in a new Docker container and then exit?
docker start
docker create
docker exec
docker run --rm
15.
How can you display detailed information about a specific Docker image?
docker details image
docker show image
docker info image
docker image inspect
16.
What is the purpose of the 'docker logs' command?
To list all available logs
To show system-wide logs
To display the logs of a specific container
To monitor real-time log changes
17.
How do you override the default command of a Docker image when running a container?
docker set-command
docker run --command
docker modify-command
docker override-command
18.
How can you create a named Docker volume?
docker create volume
docker volume create
docker add volume
docker make volume
19.
What is the purpose of the 'docker diff' command?
To show changes in the Docker daemon
To compare two Docker images
To display differences in container filesystem
To inspect differences between containers
20.
How can you view the history of a Docker image?
docker image history
docker history
docker show history
docker inspect history