Q. What is a Docker registry?

  • (A) A tool for managing containers
  • (B) A server that stores and distributes Docker images
  • (C) A platform for deploying Docker containers
  • (D) A command to run Docker images
πŸ’¬ Discuss
βœ… Correct Answer: (B) A server that stores and distributes Docker images
Explanation: A Docker registry is a service for storing and distributing Docker images. Docker Hub is a common public registry.

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

  • (A) docker rm
  • (B) docker delete
  • (C) docker stop
  • (D) docker remove
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker rm
Explanation: The 'docker rm' command removes a stopped container.

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

  • (A) Starts a new container from an image
  • (B) Builds a Docker image
  • (C) Lists all running containers
  • (D) Removes a container
πŸ’¬ Discuss
βœ… Correct Answer: (A) Starts a new container from an image
Explanation: The 'docker run' command starts a new container from a specified image.

Q. What is the purpose of the Docker 'volume' feature?

  • (A) To allocate CPU resources to containers
  • (B) To persist data in containers across restarts
  • (C) To manage network configurations
  • (D) To configure container memory
πŸ’¬ Discuss
βœ… Correct Answer: (B) To persist data in containers across restarts
Explanation: Docker volumes are used to persist data in containers, ensuring data remains intact across container restarts.

Q. Which command is used to see the logs of a running Docker container?

  • (A) docker logs
  • (B) docker show logs
  • (C) docker ps
  • (D) docker stats
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker logs
Explanation: The 'docker logs' command is used to view the logs of a running or stopped container.

Q. Which of the following commands is used to list Docker images?

  • (A) docker images
  • (B) docker list images
  • (C) docker show images
  • (D) docker image list
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker images
Explanation: The 'docker images' command lists all Docker images available on the local machine.

Q. What is the purpose of a Dockerfile?

  • (A) To configure the host machine for Docker
  • (B) To define the steps required to build a Docker image
  • (C) To deploy Docker containers
  • (D) To set environment variables in containers
πŸ’¬ Discuss
βœ… Correct Answer: (B) To define the steps required to build a Docker image
Explanation: A Dockerfile defines the steps and commands needed to build a Docker image.

Q. How do you start a container in the background (detached mode)?

  • (A) docker run -d
  • (B) docker start -d
  • (C) docker container run -d
  • (D) docker exec -d
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker run -d
Explanation: The '-d' flag in the 'docker run' command is used to run the container in detached mode (in the background).

Q. Which command is used to view running containers in Docker?

  • (A) docker list
  • (B) docker ps
  • (C) docker containers
  • (D) docker view
πŸ’¬ Discuss
βœ… Correct Answer: (B) docker ps
Explanation: The 'docker ps' command is used to view the currently running containers.

Q. How can you stop a running Docker container?

  • (A) docker stop
  • (B) docker halt
  • (C) docker end
  • (D) docker terminate
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker stop
Explanation: The 'docker stop' command stops a running Docker container.