Q. Which of the following Docker commands is used to remove a specific image?

  • (A) docker rm image_name
  • (B) docker rmi image_name
  • (C) docker remove image_name
  • (D) docker image rm image_name
πŸ’¬ Discuss
βœ… Correct Answer: (B) docker rmi image_name
Explanation: 'docker rmi image_name' is used to remove a specific Docker image.

Q. What is Docker Compose primarily used for?

  • (A) Building images from a Dockerfile
  • (B) Defining and running multi-container Docker applications
  • (C) Running a single container application
  • (D) Orchestrating containers across multiple hosts
πŸ’¬ Discuss
βœ… Correct Answer: (B) Defining and running multi-container Docker applications
Explanation: Docker Compose is used to define and manage multi-container Docker applications using a configuration file.

Q. Which of the following options is used to pass environment variables to a Docker container?

  • (A) -e
  • (B) --env
  • (C) --env-file
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above
Explanation: Docker allows passing environment variables to containers using '-e', '--env', or '--env-file'.

Q. What is the role of the Docker daemon?

  • (A) To manage and run Docker containers
  • (B) To configure Docker settings
  • (C) To monitor Docker images
  • (D) To create Docker images
πŸ’¬ Discuss
βœ… Correct Answer: (A) To manage and run Docker containers
Explanation: The Docker daemon is responsible for managing and running Docker containers.

Q. Which command is used to remove a running container?

  • (A) docker stop -f
  • (B) docker rm -f
  • (C) docker remove -f
  • (D) docker kill -f
πŸ’¬ Discuss
βœ… Correct Answer: (B) docker rm -f
Explanation: 'docker rm -f' is used to forcefully remove a running container.

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

  • (A) Volumes persist data across container restarts
  • (B) Volumes are ephemeral and get deleted when the container is deleted
  • (C) Volumes are only accessible inside the container
  • (D) Volumes are used for storing images
πŸ’¬ Discuss
βœ… Correct Answer: (A) Volumes persist data across container restarts
Explanation: Docker volumes persist data even if the container is stopped or deleted.

Q. Which of the following commands is used to pull a Docker image from Docker Hub?

  • (A) docker pull image_name
  • (B) docker fetch image_name
  • (C) docker get image_name
  • (D) docker download image_name
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker pull image_name
Explanation: 'docker pull image_name' is used to download an image from Docker Hub.

Q. What is the default port for the Docker daemon?

  • (A) 8080
  • (B) 2375
  • (C) 443
  • (D) 5000
πŸ’¬ Discuss
βœ… Correct Answer: (B) 2375
Explanation: The default port for the Docker daemon is 2375 for non-SSL communication.

Q. What is the purpose of the 'docker exec' command?

  • (A) To execute a command inside a running container
  • (B) To create a new container
  • (C) To stop a running container
  • (D) To list running containers
πŸ’¬ Discuss
βœ… Correct Answer: (A) To execute a command inside a running container
Explanation: 'docker exec' allows you to execute commands inside a running container.

Q. Which Docker command is used to list all images on the local system?

  • (A) docker images
  • (B) docker list images
  • (C) docker show images
  • (D) docker image list
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker images
Explanation: 'docker images' is used to list all images present on the local system.