Q. Which command is used to view the Docker build history of an image?

  • (A) docker history
  • (B) docker inspect
  • (C) docker logs
  • (D) docker build history
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker history
Explanation: The 'docker history' command displays the build history of a Docker image, including the layers and commands used.

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

  • (A) To execute a command as a specific user in a running container
  • (B) To execute a command as the root user
  • (C) To execute a command in all containers
  • (D) To execute a command in a stopped container
πŸ’¬ Discuss
βœ… Correct Answer: (A) To execute a command as a specific user in a running container
Explanation: The 'docker-compose exec --user' command executes a command as a specific user in a running container.

Q. Which command is used to remove all unused Docker build cache?

  • (A) docker builder prune
  • (B) docker system prune
  • (C) docker clean cache
  • (D) docker remove cache
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker builder prune
Explanation: The 'docker builder prune' command removes all unused Docker build cache.

Q. What is the purpose of the 'docker-compose logs --follow' command?

  • (A) To follow the logs of services in real-time
  • (B) To view logs for a specific container
  • (C) To view Docker system logs
  • (D) To view Docker Hub logs
πŸ’¬ Discuss
βœ… Correct Answer: (A) To follow the logs of services in real-time
Explanation: The 'docker-compose logs --follow' command follows the logs of services defined in the 'docker-compose.yml' file in real-time.

Q. Which command is used to view the Docker container's resource usage statistics?

  • (A) docker stats
  • (B) docker top
  • (C) docker inspect
  • (D) docker logs
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker stats
Explanation: The 'docker stats' command displays real-time resource usage statistics (CPU, memory, etc.) for running containers.

Q. What is the purpose of the 'docker-compose config --volumes' command?

  • (A) To list all volumes defined in a docker-compose.yml file
  • (B) To validate the docker-compose.yml file
  • (C) To display the configuration of volumes
  • (D) To list all containers
πŸ’¬ Discuss
βœ… Correct Answer: (A) To list all volumes defined in a docker-compose.yml file
Explanation: The 'docker-compose config --volumes' command lists all volumes defined in the 'docker-compose.yml' file.

Q. Which command is used to view the Docker container's environment variables?

  • (A) docker inspect
  • (B) docker env
  • (C) docker logs
  • (D) docker top
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker inspect
Explanation: The 'docker inspect' command provides detailed information about a container, including its environment variables.

Q. What is the purpose of the 'docker-compose pull --ignore-pull-failures' command?

  • (A) To pull images for services, ignoring failures
  • (B) To pull images for all services
  • (C) To pull images without caching
  • (D) To pull images for specific services
πŸ’¬ Discuss
βœ… Correct Answer: (A) To pull images for services, ignoring failures
Explanation: The 'docker-compose pull --ignore-pull-failures' command pulls images for services, ignoring any failures that occur.

Q. Which command is used to view the Docker container's network settings?

  • (A) docker inspect
  • (B) docker network inspect
  • (C) docker logs
  • (D) docker top
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker inspect
Explanation: The 'docker inspect' command provides detailed information about a container, including its network settings.

Q. What is the purpose of the 'docker-compose config --hash' command?

  • (A) To display the hash of services defined in a docker-compose.yml file
  • (B) To validate the docker-compose.yml file
  • (C) To display the configuration of services
  • (D) To list all containers
πŸ’¬ Discuss
βœ… Correct Answer: (A) To display the hash of services defined in a docker-compose.yml file
Explanation: The 'docker-compose config --hash' command displays the hash of services defined in the 'docker-compose.yml' file.