Q. Which of the following is used to store persistent data outside of containers?

  • (A) Volumes
  • (B) Containers
  • (C) Dockerfile
  • (D) Images
πŸ’¬ Discuss
βœ… Correct Answer: (A) Volumes
Explanation: Volumes in Docker are used to persist data and are independent of the container lifecycle.

Q. Which of the following commands is used to rebuild an image in Docker?

  • (A) docker rebuild
  • (B) docker image build
  • (C) docker build
  • (D) docker rebuild image
πŸ’¬ Discuss
βœ… Correct Answer: (C) docker build
Explanation: 'docker build' is used to create an image from a Dockerfile.

Q. Which Docker command is used to get the stats of running containers?

  • (A) docker status
  • (B) docker stats
  • (C) docker info
  • (D) docker system
πŸ’¬ Discuss
βœ… Correct Answer: (B) docker stats
Explanation: 'docker stats' is used to display a live stream of container(s) resource usage statistics.

Q. Which of the following is a valid Docker network type?

  • (A) bridge
  • (B) macvlan
  • (C) host
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above
Explanation: Docker supports various network types including bridge, macvlan, and host.

Q. Which Docker command is used to remove an image?

  • (A) docker rmi
  • (B) docker rm
  • (C) docker image remove
  • (D) docker delete image
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker rmi
Explanation: 'docker rmi' removes an image from the local machine.

Q. What is the default location where Docker stores images and containers on Linux?

  • (A) /var/lib/docker
  • (B) /etc/docker
  • (C) /usr/local/docker
  • (D) /docker
πŸ’¬ Discuss
βœ… Correct Answer: (A) /var/lib/docker
Explanation: On Linux, Docker stores images and containers by default in the '/var/lib/docker' directory.

Q. Which of the following commands is used to stop a running container?

  • (A) docker stop
  • (B) docker end
  • (C) docker halt
  • (D) docker shutdown
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker stop
Explanation: 'docker stop' is used to stop a running container.

Q. How do you get information about a specific Docker image?

  • (A) docker image inspect image_name
  • (B) docker inspect image_name
  • (C) docker info image_name
  • (D) docker image details image_name
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker image inspect image_name
Explanation: 'docker image inspect' provides detailed information about a specific image.

Q. How can you limit the CPU usage of a Docker container?

  • (A) --cpu-shares
  • (B) --cpus
  • (C) --cpu-limit
  • (D) --cpu
πŸ’¬ Discuss
βœ… Correct Answer: (B) --cpus
Explanation: The '--cpus' flag is used to limit the number of CPUs a container can use.

Q. What does the 'docker-compose.yml' file define?

  • (A) The specifications and configuration for a multi-container Docker application
  • (B) A single container configuration
  • (C) The Dockerfile for building an image
  • (D) A script for stopping containers
πŸ’¬ Discuss
βœ… Correct Answer: (A) The specifications and configuration for a multi-container Docker application
Explanation: 'docker-compose.yml' defines the configuration and services required for multi-container Docker applications.