Q. Which of the following commands is used to stop all running Docker containers?

  • (A) docker stop --all
  • (B) docker stop $(docker ps -q)
  • (C) docker kill --all
  • (D) docker terminate containers
πŸ’¬ Discuss
βœ… Correct Answer: (B) docker stop $(docker ps -q)
Explanation: 'docker stop $(docker ps -q)' stops all running Docker containers by passing their IDs.

Q. Which command can be used to check the status of Docker services in a Swarm mode?

  • (A) docker swarm status
  • (B) docker service list
  • (C) docker node status
  • (D) docker service ps
πŸ’¬ Discuss
βœ… Correct Answer: (D) docker service ps
Explanation: 'docker service ps' is used to list and check the status of tasks running in a Docker Swarm service.

Q. Which of the following Docker commands is used to scale a service in Docker Swarm?

  • (A) docker service scale service_name=replicas
  • (B) docker scale service_name replicas
  • (C) docker swarm scale service_name replicas
  • (D) docker scale replicas service_name
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker service scale service_name=replicas
Explanation: 'docker service scale service_name=replicas' is used to scale a service to the desired number of replicas in Docker Swarm.

Q. Which of the following Docker commands is used to view detailed information about a Docker image?

  • (A) docker inspect image_name
  • (B) docker image show image_name
  • (C) docker images info image_name
  • (D) docker image details image_name
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker inspect image_name
Explanation: 'docker inspect image_name' is used to view detailed information about a Docker image.

Q. What does the 'docker exec -it container_name /bin/sh' command do?

  • (A) Starts a new container in interactive mode
  • (B) Executes a bash shell inside a running container
  • (C) Starts a new shell in the Docker host system
  • (D) Executes the shell command in the background
πŸ’¬ Discuss
βœ… Correct Answer: (B) Executes a bash shell inside a running container
Explanation: 'docker exec -it container_name /bin/sh' opens an interactive shell inside the specified container.

Q. Which Docker command can be used to list all available images on your system?

  • (A) docker list images
  • (B) docker images
  • (C) docker show images
  • (D) docker image list
πŸ’¬ Discuss
βœ… Correct Answer: (B) docker images
Explanation: 'docker images' lists all Docker images stored locally on your system.

Q. Which of the following is true about Docker containers?

  • (A) Docker containers run on a full virtual machine
  • (B) Docker containers share the host OS kernel
  • (C) Docker containers require a separate kernel for each container
  • (D) Docker containers are isolated from the host OS
πŸ’¬ Discuss
βœ… Correct Answer: (B) Docker containers share the host OS kernel
Explanation: Docker containers share the host OS kernel, making them lightweight compared to virtual machines.

Q. Which of the following Docker components is responsible for managing containers and images?

  • (A) Docker engine
  • (B) Docker daemon
  • (C) Docker client
  • (D) Docker manager
πŸ’¬ Discuss
βœ… Correct Answer: (B) Docker daemon
Explanation: The Docker daemon is responsible for managing containers, images, networks, and volumes on the host system.

Q. What does the 'docker commit' command do?

  • (A) Creates a new container from an existing image
  • (B) Saves changes made in a container to a new image
  • (C) Pushes an image to a remote registry
  • (D) Stops a running container
πŸ’¬ Discuss
βœ… Correct Answer: (B) Saves changes made in a container to a new image
Explanation: 'docker commit' is used to create a new image from changes made to a running container.

Q. What does the 'docker pull' command do?

  • (A) Pushes a Docker image to the registry
  • (B) Downloads a Docker image from the registry
  • (C) Starts a container from an image
  • (D) Creates a new Docker image
πŸ’¬ Discuss
βœ… Correct Answer: (B) Downloads a Docker image from the registry
Explanation: 'docker pull' is used to download a Docker image from a registry such as Docker Hub.