Q. Which Docker command is used to stop a 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' is used to stop a running container.

Q. What is the default mode in which 'docker-compose' runs?

  • (A) Detached
  • (B) Foreground
  • (C) Interactive
  • (D) Automated
πŸ’¬ Discuss
βœ… Correct Answer: (B) Foreground
Explanation: By default, 'docker-compose' runs in the foreground, showing logs and output.

Q. Which of the following commands is used to build a Docker image from a Dockerfile?

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

Q. Which of the following commands lists all the Docker networks?

  • (A) docker network ls
  • (B) docker networks list
  • (C) docker net show
  • (D) docker list networks
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker network ls
Explanation: 'docker network ls' is used to list all the Docker networks.

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

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

Q. Which of the following is the default network driver in Docker?

  • (A) host
  • (B) bridge
  • (C) overlay
  • (D) macvlan
πŸ’¬ Discuss
βœ… Correct Answer: (B) bridge
Explanation: The default network driver in Docker is 'bridge'.

Q. What does the 'docker ps -a' command show?

  • (A) The list of all containers, including stopped ones
  • (B) The list of all images on the host
  • (C) The list of all volumes
  • (D) The list of running containers
πŸ’¬ Discuss
βœ… Correct Answer: (A) The list of all containers, including stopped ones
Explanation: 'docker ps -a' shows the list of all containers, including stopped ones.

Q. Which Docker command is used to build images from a Dockerfile?

  • (A) docker build -t image_name .
  • (B) docker create -t image_name .
  • (C) docker run -t image_name .
  • (D) docker image build -t image_name .
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker build -t image_name .
Explanation: 'docker build -t image_name .' is used to build an image from a Dockerfile in the current directory.

Q. What is the function of a Docker registry?

  • (A) To store and distribute Docker images
  • (B) To monitor the health of Docker containers
  • (C) To manage Docker networks
  • (D) To manage container volumes
πŸ’¬ Discuss
βœ… Correct Answer: (A) To store and distribute Docker images
Explanation: A Docker registry is used to store and distribute Docker images.

Q. What is the default location for Docker configuration files on Linux?

  • (A) /etc/docker
  • (B) /usr/docker
  • (C) /var/docker
  • (D) /etc/docker/config
πŸ’¬ Discuss
βœ… Correct Answer: (A) /etc/docker
Explanation: On Linux, Docker configuration files are typically located in the '/etc/docker' directory.