Q. What is a 'Docker network'?

  • (A) A connection between containers for network communication
  • (B) A storage solution for Docker containers
  • (C) A group of Docker images
  • (D) A monitoring tool for Docker containers
πŸ’¬ Discuss
βœ… Correct Answer: (A) A connection between containers for network communication
Explanation: A Docker network allows containers to communicate with each other, either within the same host or across multiple hosts.

Q. Which command is used to get detailed information about a running Docker container?

  • (A) docker inspect container_name
  • (B) docker container details container_name
  • (C) docker stats container_name
  • (D) docker show container_name
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker inspect container_name
Explanation: 'docker inspect container_name' provides detailed information about a running container.

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

  • (A) Volumes are used to store data generated by and used by Docker containers
  • (B) Volumes are ephemeral and cannot be shared between containers
  • (C) Volumes only work with Linux-based containers
  • (D) Volumes are used to store Docker images
πŸ’¬ Discuss
βœ… Correct Answer: (A) Volumes are used to store data generated by and used by Docker containers
Explanation: Docker volumes are used to persist data generated and used by Docker containers, and they can be shared between containers.

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

  • (A) Creates a new Docker image from a Dockerfile
  • (B) Starts a container from an existing image
  • (C) Lists all available Docker images
  • (D) Removes a Docker image
πŸ’¬ Discuss
βœ… Correct Answer: (A) Creates a new Docker image from a Dockerfile
Explanation: 'docker build' is used to create a new Docker image from a Dockerfile.

Q. Which of the following is a valid Docker command to list all stopped containers?

  • (A) docker ps -a
  • (B) docker containers --stopped
  • (C) docker ps --stopped
  • (D) docker list stopped
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker ps -a
Explanation: 'docker ps -a' lists all containers, including stopped ones.

Q. Which of the following commands will remove a Docker image?

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

Q. What is a Docker 'Dockerfile'?

  • (A) A configuration file used to build a Docker image
  • (B) A file that defines the environment variables for Docker containers
  • (C) A file used to orchestrate containers in Docker Swarm
  • (D) A file used to manage Docker volumes
πŸ’¬ Discuss
βœ… Correct Answer: (A) A configuration file used to build a Docker image
Explanation: A Dockerfile is a script containing a series of instructions on how to build a Docker image.

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

  • (A) Runs a command inside a running container
  • (B) Starts a new container
  • (C) Stops a running container
  • (D) Removes a container
πŸ’¬ Discuss
βœ… Correct Answer: (A) Runs a command inside a running container
Explanation: 'docker exec' is used to run commands inside a running container.

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

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

Q. What is the role of Docker's 'CMD' instruction in a Dockerfile?

  • (A) To set the default command to be executed when a container starts
  • (B) To specify the environment variables
  • (C) To specify the base image for the container
  • (D) To expose container ports
πŸ’¬ Discuss
βœ… Correct Answer: (A) To set the default command to be executed when a container starts
Explanation: 'CMD' specifies the default command to be executed when the container starts.