πŸ“Š Docker
Q. Which file is used to define a Docker image?
  • (A) Dockerfile
  • (B) docker-compose.yml
  • (C) docker-config.json
  • (D) docker-image.yml
πŸ’¬ Discuss
βœ… Correct Answer: (A) Dockerfile

Explanation: A Dockerfile is a text document that contains instructions for building a Docker image.

πŸ“Š Docker
Q. What 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', which creates a private internal network for containers.

πŸ“Š Docker
Q. Which command is used to stop a running Docker container?
  • (A) docker stop
  • (B) docker kill
  • (C) docker pause
  • (D) docker halt
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker stop

Explanation: The 'docker stop' command gracefully stops a running container.

πŸ“Š Docker
Q. What is Docker Hub?
  • (A) A local Docker registry
  • (B) A cloud-based repository for Docker images
  • (C) A Docker networking tool
  • (D) A Docker monitoring service
πŸ’¬ Discuss
βœ… Correct Answer: (B) A cloud-based repository for Docker images

Explanation: Docker Hub is a cloud-based repository where Docker users can store and share Docker images.

πŸ“Š Docker
Q. Which command is used to remove a Docker container?
  • (A) docker rm
  • (B) docker delete
  • (C) docker remove
  • (D) docker erase
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker rm

Explanation: The 'docker rm' command is used to remove one or more containers.

πŸ“Š Docker
Q. What is the purpose of the EXPOSE instruction in a Dockerfile?
  • (A) To open a port on the host machine
  • (B) To document which ports are used by the container
  • (C) To publish a container's port to the host
  • (D) To map a container's port to a specific host port
πŸ’¬ Discuss
βœ… Correct Answer: (B) To document which ports are used by the container

Explanation: The EXPOSE instruction documents which ports are intended to be used by the container.

πŸ“Š Docker
Q. Which command is used to build a Docker image from a Dockerfile?
  • (A) docker build
  • (B) docker create
  • (C) docker run
  • (D) docker image
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker build

Explanation: The 'docker build' command builds an image from a Dockerfile.

πŸ“Š Docker
Q. What is the purpose of the CMD instruction in a Dockerfile?
  • (A) To specify the base image
  • (B) To define the default command to run in the container
  • (C) To set environment variables
  • (D) To copy files into the container
πŸ’¬ Discuss
βœ… Correct Answer: (B) To define the default command to run in the container

Explanation: The CMD instruction specifies the default command to run when the container starts.

πŸ“Š Docker
Q. Which command is used to view logs of a Docker container?
  • (A) docker logs
  • (B) docker view
  • (C) docker inspect
  • (D) docker history
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker logs

Explanation: The 'docker logs' command fetches the logs of a container.

πŸ“Š Docker
Q. What is the purpose of the ENTRYPOINT instruction in a Dockerfile?
  • (A) To specify the base image
  • (B) To define the default command to run in the container
  • (C) To set environment variables
  • (D) To copy files into the container
πŸ’¬ Discuss
βœ… Correct Answer: (B) To define the default command to run in the container

Explanation: The ENTRYPOINT instruction defines the default command to run when the container starts.