Docker MCQs – Docker and CI/CD

11.) How does Docker Compose enhance CI/CD workflows?

A) By orchestrating multi-container applications
B) By creating Docker images
C) By pulling images from registries
D) By replacing CI/CD tools like Jenkins

Answer: Option A

Explanation: Docker Compose is used to define and orchestrate multi-container applications, which is useful in CI/CD workflows.

12.) Which of the following is a key feature of using Docker in CI/CD pipelines?

A) Automatic database backups
B) Environment consistency across stages
C) Replacement of testing frameworks
D) Elimination of all errors

Answer: Option B

Explanation: Docker ensures environment consistency across development, testing, and production, which is crucial for CI/CD pipelines.

13.) What is the role of the –cache-from flag in Docker build commands?

A) To clear image cache
B) To build multi-stage images
C) To use cached layers from a previous build
D) To scan images for vulnerabilities

Answer: Option C

Explanation: The –cache-from flag allows Docker to use cached layers from a previous build, reducing build time.

14.) Which file format is typically used to define CI/CD pipelines in GitLab CI/CD?

A) gitlab-ci.yml
B) pipeline.yml
C) docker-compose.yml
D) config.json

Answer: Option A

Explanation: In GitLab CI/CD, the gitlab-ci.yml file defines the pipeline configuration.

15.) What role does Docker Swarm play in a CI/CD pipeline?

A) Monitoring containers
B) Orchestrating containers for deployment
C) Building Docker images
D) Storing container logs

Answer: Option B

Explanation: Docker Swarm is a container orchestration tool that helps deploy and manage containers in production.

16.) What is the primary benefit of using Docker Hub in a CI/CD process?

A) Logging container activity
B) Automating database migrations
C) Providing a centralized location for Docker images
D) Enabling container resource limits

Answer: Option C

Explanation: Docker Hub provides a centralized repository for storing and sharing Docker images used in CI/CD workflows.

17.) Which of the following is a common step in Docker-based CI/CD pipelines?

A) Container orchestration
B) Image scanning for vulnerabilities
C) Image version tagging
D) All of the above

Answer: Option D

Explanation: Docker-based CI/CD pipelines often include orchestration, image scanning, and version tagging as standard steps.

18.) Why is tagging Docker images important in CI/CD pipelines?

A) To improve build speed
B) To uniquely identify and version images
C) To encrypt image layers
D) To reduce image size

Answer: Option B

Explanation: Tagging helps uniquely identify Docker images and ensures the correct version is used in CI/CD pipelines.

19.) How can Docker ensure application rollback in a CI/CD pipeline?

A) By saving previous container logs
B) By creating snapshots of running containers
C) By using a versioned Docker image from the registry
D) By monitoring container health

Answer: Option C

Explanation: Docker enables application rollback by using versioned images stored in a registry.

20.) What is the purpose of the docker-compose.override.yml file?

A) To replace Docker Compose
B) To define development-specific configurations
C) To deploy containers
D) To automate image builds

Answer: Option B

Explanation: The docker-compose.override.yml file is used to define environment-specific overrides for Docker Compose configurations.

Leave a Reply

Your email address will not be published. Required fields are marked *