Unit 3 - Practice Quiz

INT332 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 What is a primary characteristic of a monolithic application architecture?

Monolithic vs microservices Easy
A. The database is always hosted on a separate cloud provider.
B. Every function has its own dedicated server.
C. The application is divided into hundreds of isolated containers.
D. The application is built as a single, unified unit.

2 Why do modern applications often use a microservices architecture?

Need for microservices Easy
A. To combine all code into one large file.
B. To eliminate the need for computer networks.
C. To allow teams to develop, deploy, and scale application components independently.
D. To ensure that if one feature fails, the entire application crashes.

3 How does microservices architecture improve scalability?

Advantages: scalability Easy
A. It replicates the entire application regardless of which part needs scaling.
B. It requires buying larger physical servers.
C. It limits the number of users that can access the application.
D. You can scale only the specific services that experience high demand.

4 What does fault isolation mean in the context of microservices?

Advantages: isolation Easy
A. Developers work in isolated rooms.
B. Microservices cannot communicate with each other.
C. Databases are disconnected from the internet.
D. A failure in one service does not necessarily bring down the entire application.

5 What is the primary role of an API Gateway in a microservices architecture?

API Gateway Easy
A. To store database backups.
B. To act as an operating system for containers.
C. To act as a single entry point for client requests and route them to the appropriate microservices.
D. To write code for the frontend.

6 What file format is primarily used by Docker Compose for its configuration files?

Docker Compose: YAML Structure Easy
A. YAML
B. HTML
C. XML
D. JSON

7 What is the default filename Docker Compose looks for when you run the docker-compose up command?

Writing docker-compose.yml Easy
A. docker.json
B. compose.xml
C. Dockerfile
D. docker-compose.yml

8 What does the version field at the top of a docker-compose.yml file specify?

version Easy
A. The version of the Linux kernel.
B. The number of containers to create.
C. The version of your application code.
D. The version of the Docker Compose file format being used.

9 In a docker-compose.yml file, what does the services section define?

services Easy
A. The different containers (or application components) that make up the application.
B. The customer support contact information.
C. The physical hardware specifications.
D. The cloud provider hosting the app.

10 What is the purpose of defining volumes in Docker Compose?

volumes Easy
A. To measure the amount of memory used.
B. To increase the sound volume of the application.
C. To persist data generated by and used by Docker containers.
D. To delete temporary files.

11 What is the function of the networks field in a docker-compose.yml file?

networks Easy
A. To schedule automatic updates.
B. To download the Docker engine.
C. To connect to social media platforms.
D. To define how containers communicate with each other.

12 How do you pass configuration settings, like database passwords, to a container in Docker Compose?

Environment variables Easy
A. Using the environment or env_file keywords in the YAML file.
B. By sending an email to the container.
C. By hardcoding them into the operating system.
D. By printing them to the terminal.

13 What is the difference between the build and image directives in Docker Compose?

Build vs image fields in YAML Easy
A. build downloads a pre-made image, while image deletes it.
B. There is no difference; they are interchangeable.
C. build starts the container, while image stops it.
D. build tells Compose to build an image from a Dockerfile, while image specifies a pre-built image to pull from a registry.

14 Which Docker Compose keyword is used to express dependency between services, ensuring one starts before another?

Service dependency ordering Easy
A. depends_on
B. wait_for
C. start_first
D. needs

15 In Docker Compose, what is the best practice for handling highly sensitive data like API keys or TLS certificates?

Secrets and configs Easy
A. Store them in plain text in the GitHub repository.
B. Put them in the container's public logs.
C. Use Docker secrets to mount sensitive data securely into the container.
D. Hardcode them in the Dockerfile.

16 In a standard three-tier multi-container application, what does the backend container usually do?

Multi-container apps (database + backend + frontend) Easy
A. It displays the user interface to the client.
B. It manages the physical network cables.
C. It only stores long-term data files.
D. It processes business logic and communicates with the database.

17 When deploying a WordPress application using Docker Compose, which database is traditionally paired with it as a separate service?

WordPress + MySQL Easy
A. MongoDB
B. Redis
C. MySQL
D. Cassandra

18 Why is MongoDB frequently paired with Node.js in multi-container deployments (the MEAN/MERN stack)?

Node.js + MongoDB Easy
A. MongoDB stores data in JSON-like documents, which works seamlessly with JavaScript in Node.js.
B. MongoDB is a relational database requiring complex SQL.
C. MongoDB is the only database supported by Docker.
D. Node.js natively speaks SQL.

19 When using Docker Compose to deploy a Java Spring Boot backend, what kind of service is PostgreSQL?

Java Spring Boot + PostgreSQL Easy
A. A relational database management system.
B. A message broker.
C. An API Gateway.
D. A frontend web framework.

20 How do microservices improve agility for development teams?

Advantages: agility Easy
A. Agility is reduced because the code is too small.
B. Teams can develop, test, and deploy features quickly and independently.
C. Teams must wait for the entire company to finish coding before releasing.
D. Developers are forced to use only one programming language.

21 An e-commerce application is experiencing high traffic exclusively on its payment processing module during a sale. How does a microservices architecture handle this more efficiently than a monolithic architecture?

Monolithic vs microservices Medium
A. By scaling the entire application cluster to handle the payment load.
B. By sharing the payment processing database with the product catalog to balance the load.
C. By scaling only the payment processing service independently without replicating the rest of the application.
D. By deploying the monolith inside a single larger Docker container with more CPU allocated.

22 In a microservices architecture involving a UI frontend and multiple backend services (e.g., users, orders, inventory), what is the primary role of an API Gateway?

API Gateway Medium
A. It acts as a single entry point, routing client requests to the appropriate underlying microservices.
B. It continuously monitors the health of Docker containers and restarts them if they fail.
C. It replaces the need for a frontend client by rendering HTML directly to the user.
D. It serves as the primary database for all microservices to ensure data consistency.

23 A developer introduces a memory leak in the 'Reporting' microservice. Under a microservices architecture, how does the 'isolation' advantage prevent a system-wide outage?

Advantages: scalability, isolation, agility Medium
A. Docker Compose will dynamically allocate infinite memory to the reporting service to prevent a crash.
B. The API Gateway will re-route the memory leak to a backup database.
C. The memory leak is automatically fixed by the Docker daemon before it affects other services.
D. The faulty microservice will crash, but other independent microservices will continue to function normally.

24 When defining a docker-compose.yml file, what does the version field primarily dictate?

version Medium
A. The specific compose file format and the supported features compatible with the installed Docker Engine.
B. The version of the operating system running on the host machine.
C. The version of the Docker images being pulled from Docker Hub.
D. The version of the application code expected inside the container.

25 A PostgreSQL database container is destroyed and recreated using Docker Compose, resulting in complete data loss. Which configuration should be added to the docker-compose.yml to prevent this in the future?

volumes Medium
A. Use the deploy: restart_policy to prevent the container from ever being destroyed.
B. Map a named volume or host directory to the database's data directory using the volumes key.
C. Add a depends_on flag to ensure the database boots before the backend.
D. Add a networks key to isolate the database from the backend.

26 Which of the following represents the correct hierarchical structure for defining a web service mapped to port 80 in docker-compose.yml?

Docker Compose: YAML Structure Medium
A. yaml\nweb:\n services:\n image: nginx\n ports:\n - "80:80"\n
B. yaml\nimage: nginx\nservices:\n web:\n ports:\n - "80:80"\n
C. yaml\nservices:\n image: nginx\n web:\n ports:\n - "80:80"\n
D. yaml\nservices:\n web:\n image: nginx\n ports:\n - "80:80"\n

27 If an environment variable DB_PASS is defined in an .env file, and simultaneously defined under the environment section of a service in docker-compose.yml with a different value, what will be the value inside the container?

Environment variables Medium
A. The values will be concatenated together.
B. The value defined in the docker-compose.yml file, as it overrides the .env file.
C. The value from the .env file, as it takes global precedence.
D. The container will fail to start due to a variable conflict.

28 You have a frontend service and a backend service in docker-compose.yml. You want the backend to communicate with the database, but the frontend should NOT be able to reach the database. How can this be achieved?

networks Medium
A. Use the expose directive on the database so it is only visible to the host machine.
B. Set network_mode: isolated for the database service.
C. Create two separate custom networks (e.g., frontend_net, backend_net), connect the backend to both, the frontend to frontend_net, and the database to backend_net.
D. Assign all three services to the default network but use firewall rules inside the frontend container.

29 In a docker-compose.yml, what happens if a service defines BOTH the build and image fields?

Build vs image fields in YAML Medium
A. Docker Compose ignores the build field and exclusively pulls the image from Docker Hub.
B. Docker Compose throws a syntax error and refuses to run.
C. Docker Compose builds the image from the specified build context and tags it with the name provided in the image field.
D. Docker Compose builds the image but ignores the image tag, assigning a random hash as the name.

30 A Node.js backend crashes upon startup because the MongoDB container it depends on is still initializing, even though depends_on: - mongo is used. What is the correct way to ensure the backend waits until MongoDB is fully ready to accept connections?

Service dependency ordering Medium
A. Use depends_on with condition: service_started.
B. Set restart: always on the MongoDB container to speed up its boot time.
C. Use depends_on with condition: service_healthy and configure a healthcheck in the MongoDB service.
D. Use a sleep 30 command inside the docker-compose.yml for the backend.

31 When passing highly sensitive data like an API token to a service in Docker Compose, why is using Docker Secrets generally preferred over standard environment variables?

Secrets and configs Medium
A. Environment variables can only hold up to 256 characters, which is too short for most API tokens.
B. Docker Secrets automatically rotate the token every 30 days without application downtime.
C. Secrets bypass the Docker daemon and are injected directly by the host OS kernel.
D. Secrets are encrypted at rest and mounted into the container's in-memory filesystem (tmpfs), reducing exposure in logs or docker inspect.

32 When deploying a WordPress + MySQL stack using Docker Compose, how does the WordPress container know how to locate the MySQL database?

WordPress + MySQL Medium
A. By mapping the same port 3306 on both containers so they share the network stack.
B. By setting the environment variable WORDPRESS_DB_HOST to the service name of the MySQL container.
C. By querying the Docker daemon API for the IP address of the MySQL container.
D. By hardcoding the host machine's localhost IP into the WordPress configuration.

33 A developer sets up a Node.js backend and a MongoDB database. The database service is named mongo_db. What should the Mongoose connection string look like in the Node.js application?

Node.js + MongoDB Medium
A. mongodb://127.0.0.1:27017/myapp
B. mongodb://mongo_db:27017/myapp
C. mongodb://docker-host:27017/myapp
D. mongodb://localhost:27017/myapp

34 In a Docker Compose deployment of a Spring Boot app and a PostgreSQL database, the Spring Boot application configuration (application.properties) has spring.datasource.url=jdbc:postgresql://postgres_server:5432/mydb. Which of the following MUST be true in docker-compose.yml for the connection to work?

Java Spring Boot + PostgreSQL Medium
A. The PostgreSQL container must use the latest image tag.
B. The database must map port 5432 to the host machine using ports: - "5432:5432".
C. The Spring Boot service must use network_mode: host.
D. The database service must be named postgres_server or have an alias of postgres_server on the shared network.

35 You are deploying a 3-tier application (React frontend, Express backend, PostgreSQL database) using Docker Compose. The React frontend runs in a user's browser. How should the frontend make API calls to the backend?

Use Case Deployments: Multi-container apps (database + backend + frontend) Medium
A. By establishing a direct TCP connection to the PostgreSQL database container.
B. By making requests to localhost or the public domain/IP where the backend's port is exposed.
C. By making requests to the backend's internal Docker service name (e.g., http://backend:8080).
D. By using Docker's internal DNS resolver to route traffic through the API Gateway.

36 A developer writes the following snippet in docker-compose.yml:
yaml
ports:
- 8080:80

What does this mapping signify?

Writing docker-compose.yml Medium
A. Traffic to port 80 on the host machine is routed to port 8080 inside the container.
B. The container listens on port 8080 and internally forwards it to port 80.
C. Both port 8080 and 80 are exposed exclusively to other containers on the same Docker network.
D. Traffic to port 8080 on the host machine is routed to port 80 inside the container.

37 A legacy monolithic application uses a single relational database for all transactions. As the user base grows, database locks cause widespread performance issues. How does a microservices architecture address this specific 'Need for microservices'?

Microservices Architecture: Need for microservices Medium
A. By implementing a single API Gateway that queues database queries globally.
B. By utilizing polyglot persistence, where each microservice manages its own separate database.
C. By converting the relational database to a NoSQL database within the monolith.
D. By running multiple instances of the monolithic code over the same relational database.

38 If Service A depends on Service B in a docker-compose.yml file, what happens when you execute docker-compose stop Service B?

Service dependency ordering Medium
A. Docker Compose will automatically stop Service A as well to maintain dependency integrity.
B. Service B will stop, but Service A will continue running until it manually crashes or is stopped.
C. Service A will restart automatically in an attempt to reconnect to Service B.
D. Docker Compose will refuse to stop Service B and throw a dependency error.

39 A developer wants to keep database credentials out of the docker-compose.yml file tracked in Git. They place the credentials in an .env file. What is a crucial best practice regarding this .env file?

Environment variables Medium
A. Add the .env file to .gitignore so it is never committed to the version control repository.
B. Upload the .env file to a public Docker Hub repository.
C. Rename the .env file to .config so Docker Compose hides it automatically.
D. Commit the .env file to Git but encrypt it using Base64 encoding.

40 Consider the volumes configuration in a Docker Compose service:
yaml
volumes:
- mydata:/var/lib/mysql

Where must mydata be defined for this configuration to be completely valid at the file level?

Docker Compose: YAML Structure Medium
A. It does not need to be defined elsewhere; Docker Compose creates named volumes implicitly without top-level definitions.
B. It must be defined under a top-level volumes: block at the end of the docker-compose.yml file.
C. It must be defined inside the container's Dockerfile using the VOLUME instruction.
D. It must be defined within the .env file as VOLUME_NAME=mydata.

41 A team is migrating a legacy monolithic application to a microservices architecture. They notice that transactions previously handled by a single ACID-compliant database commit now span multiple distinct services and databases. Which of the following architectural patterns is most appropriate to manage data consistency across these services?

Monolithic vs microservices Hard
A. Enforcing synchronous HTTP REST calls between all services within a single user request to ensure real-time consistency.
B. Using the Saga pattern, relying on asynchronous messaging and compensating transactions to achieve eventual consistency.
C. Merging the databases back into a single shared database while keeping the application code separated into microservices.
D. Implementing a centralized Two-Phase Commit (2PC) protocol across all microservices to guarantee strict ACID properties.

42 In a Docker Compose deployment containing an API Gateway and multiple scaled instances of a backend service (e.g., docker-compose up --scale backend=3), how does the API Gateway natively resolve the internal routing to distribute traffic among the backend instances?

API Gateway Hard
A. Docker Compose's embedded DNS server resolves the service name backend to a single IP that acts as a physical load balancer.
B. The API Gateway reads the docker-compose.yml file at runtime to map host ports to individual container IPs.
C. Docker's embedded DNS server returns multiple IP addresses for the service name backend, and the API Gateway must rely on DNS Round Robin or client-side load balancing.
D. The API Gateway automatically leverages Docker Swarm's routing mesh, even when running in standard docker-compose mode.

43 When designing a complex docker-compose.yml file, you need multiple services to share identical logging configurations, environment variables, and restart policies without duplicating code. Which YAML feature is natively utilized in Compose to achieve this DRY (Don't Repeat Yourself) principle?

Docker Compose: YAML Structure Hard
A. Creating a separate docker-compose.common.yml file and importing it using the include directive inside the services block.
B. Using YAML anchors (&) on extension fields (prefixed with x-) and merging them into services using aliases (<<: *).
C. Applying the template: key under each service to reference a standardized JSON configuration file.
D. Defining a global defaults: block at the top of the Compose file and inheriting it via the inherit: key.

44 Service A has a depends_on configuration pointing to Service B with the condition service_healthy. Service B defines a healthcheck in the Compose file. If Service B starts successfully but its healthcheck repeatedly fails (returns unhealthy), what will Docker Compose do when starting the environment?

Service dependency ordering Hard
A. Docker Compose will automatically restart Service B until the healthcheck passes, and then start Service A.
B. Service A will start, but Docker Compose will detach Service B from the custom network until it becomes healthy.
C. Service A will wait indefinitely in the 'created' state, and Compose will eventually output a dependency error, preventing Service A from starting.
D. Service A will start immediately after Service B's container enters the 'running' state, ignoring the healthcheck failure.

45 Consider the following environment variable hierarchy in Docker Compose. You have an environment variable DB_PORT set to 5432 in the .env file, DB_PORT=5433 exported in your host OS shell, DB_PORT=5434 defined in an env_file referenced in the Compose file, and DB_PORT: 5435 defined directly under the environment: key of the service. What value will the container actually use for DB_PORT?

Environment variables Hard
A. 5434
B. 5432
C. 5433
D. 5435

46 In a docker-compose.yml file, a service defines both the build: ./webapp and image: custom-webapp:v2 keys simultaneously. What is the precise behavior when docker-compose up -d is executed, assuming the image custom-webapp:v2 does not exist locally?

Build vs image fields in YAML Hard
A. Compose builds the image using the context in ./webapp, tags the resulting image as custom-webapp:v2, and runs the container from it.
B. Compose builds a container from ./webapp with a random name, but aliases it to custom-webapp:v2 in the internal DNS.
C. Compose throws a syntax error because build and image are mutually exclusive fields.
D. Compose ignores the build instruction and attempts to pull custom-webapp:v2 from Docker Hub, failing if it's not found.

47 A docker-compose.yml file provisions a PostgreSQL database using a named volume db_data mounted at /var/lib/postgresql/data. Upon the very first startup, the named volume is completely empty, but the PostgreSQL base image already contains default database configuration files at /var/lib/postgresql/data. What happens to these files?

volumes Hard
A. Docker throws an error stating that a named volume cannot be mounted to a non-empty directory without the nocopy flag.
B. Docker automatically copies the existing contents from the container's directory into the empty named volume before mounting it.
C. The empty named volume overlays the directory, hiding the default files and causing PostgreSQL to crash due to missing configurations.
D. The named volume is created as read-only to preserve the underlying files, requiring a manual volume initialization script.

48 You are deploying a multi-tier application using Docker Compose with three services: frontend, backend, and database. You want frontend to only communicate with backend, and backend to communicate with both frontend and database. The database should be completely unreachable from the frontend. Which network configuration enforces this isolation?

networks Hard
A. Attach all services to the default bridge network, but configure the expose key on the database service to only accept connections from the backend container's IP.
B. Place database in an internal: true network and frontend in an external: true network, while backend acts as a reverse proxy using links.
C. Create a single network app_net. Assign frontend, backend, and database to it, and use Docker's network_policy key to restrict traffic.
D. Create two networks: front_net and back_net. Attach frontend to front_net, database to back_net, and backend to both front_net and back_net.

49 In a non-Swarm local Docker Compose deployment, a service is configured to use a secret defined via a file (e.g., file: ./db_password.txt). How is this secret materialized inside the running container, and what are the security implications compared to environment variables?

Secrets and configs Hard
A. It is injected as a hidden environment variable, preventing it from showing up in docker inspect but still visible to child processes.
B. It is temporarily passed to the container's entrypoint via standard input (stdin) to prevent leaving files on the filesystem.
C. It is mounted as an in-memory, read-only file (typically under /run/secrets/), which avoids exposing sensitive data in environment variables or docker inspect outputs.
D. It is mounted as an encrypted volume in /var/lib/docker/secrets, requiring the application to decrypt it using a private key.

50 A docker-compose.yml file contains the following environment variable declaration for a service: APP_TIMEOUT: ${TIMEOUT:?Error: TIMEOUT is not set}. If the user runs docker-compose up without defining the TIMEOUT variable in their shell or .env file, what is the exact outcome?

Environment variables Hard
A. Docker Compose starts the container but gracefully disables the APP_TIMEOUT variable, removing it from the container's environment.
B. Docker Compose immediately exits with an error message "Error: TIMEOUT is not set" and refuses to start the application.
C. Docker Compose uses a default timeout of 0 and logs a warning message containing "Error: TIMEOUT is not set".
D. Docker Compose substitutes TIMEOUT with the string "?Error: TIMEOUT is not set" and starts the container.

51 A microservices deployment features a Java Spring Boot application and a PostgreSQL database in Docker Compose. The spring-boot service depends_on the postgres service with condition: service_healthy. However, the Spring Boot application intermittently crashes on startup, throwing a Connection refused exception. Which of the following is the most likely architectural root cause?

Java Spring Boot + PostgreSQL Hard
A. The PostgreSQL healthcheck script succeeds as soon as the container's OS boots, but the database initialization scripts inside docker-entrypoint-initdb.d take longer, causing a race condition.
B. Docker Compose parses depends_on asynchronously, meaning Spring Boot can occasionally bypass the healthcheck lock if the host CPU is under heavy load.
C. Spring Boot's HikariCP connection pool attempts to resolve the postgres hostname before Docker's embedded DNS is fully initialized.
D. The service_healthy condition guarantees the PostgreSQL container is running, but it does not guarantee that PostgreSQL is ready to accept TCP connections on port 5432.

52 You are setting up a Node.js application backed by a MongoDB Replica Set using Docker Compose. A Replica Set requires an initialization command (rs.initiate()) to be run exactly once after the MongoDB nodes start. What is the most robust and Docker-native way to handle this initialization in a docker-compose.yml file?

Node.js + MongoDB Hard
A. Use the deploy.replicas key in Docker Compose to automatically inform MongoDB that it should bootstrap a replica set cluster.
B. Embed the rs.initiate() command inside the Node.js application's startup script to guarantee the database is configured before API requests are served.
C. Create an ephemeral mongo-setup service that depends_on the MongoDB nodes, runs a script with rs.initiate(), and immediately exits with restart: "no".
D. Modify the MongoDB service command to run mongod && mongo --eval "rs.initiate()" so initialization happens simultaneously with startup.

53 A user deploys WordPress and MySQL using Docker Compose. They map the WordPress container's port to 8080:80 and the MySQL container's port to 3306:3306. In the WordPress configuration (WORDPRESS_DB_HOST), they specify localhost:3306. When they navigate to http://localhost:8080, WordPress fails to connect to the database. Why does this happen, and how should it be fixed?

WordPress + MySQL Hard
A. WordPress is missing the MySQL client driver; the docker-compose.yml must include a build step to install mysqli before setting the host to localhost.
B. Port 3306 is not natively mapped to the host's loopback interface; WORDPRESS_DB_HOST must point to the Docker host gateway IP address.
C. MySQL rejects connections from port 8080; WORDPRESS_DB_HOST should be set to 127.0.0.1:3306.
D. The Docker network bridge prevents localhost routing between containers; WORDPRESS_DB_HOST should be changed to the service name of the MySQL container (e.g., db:3306).

54 In the modern Compose Specification (integrated into Docker Compose V2), the top-level version: element (e.g., version: '3.8') behaves differently than in classic docker-compose V1. Which of the following statements accurately describes the handling of the version key in modern Compose?

version Hard
A. The version key is deprecated and purely informational; modern Compose dynamically merges v2.x and v3.x features (like depends_on: condition and deploy: resources) regardless of the declared version.
B. The version key is strictly enforced, and modern Compose will crash if it detects a version lower than '3.0'.
C. The version key determines whether Compose uses the Docker Swarm orchestrator or the local Docker Engine API.
D. The version key dictates the YAML schema syntax, requiring users to specify version: 'compose-spec' to use the latest features.

55 An organization adopted microservices to increase release agility. However, they now find that every time they update the 'Order' service, they must also deploy specific versions of the 'Inventory' and 'Billing' services simultaneously to prevent system crashes. What architectural anti-pattern has the organization likely created?

Microservices Architecture: Need for microservices Hard
A. Event Sourcing
B. Polyglot Persistence
C. API Gateway Bottleneck
D. Distributed Monolith

56 In a complex docker-compose.yml, Service A depends on Service B, Service B depends on Service C, and Service C depends on Service A. All dependencies are standard (no healthcheck conditions). What is the outcome when docker-compose up is executed?

Service dependency ordering Hard
A. Compose enters an infinite loop, freezing the terminal while continuously attempting to resolve the dependency tree.
B. Compose detects the circular dependency, outputs an error, and immediately exits without starting any containers.
C. Compose starts Service C first, then Service B, and skips the dependency on Service A to break the loop automatically.
D. Compose starts Service A, B, and C in parallel, ignoring the depends_on graph because a cycle is present.

57 You have a docker-compose.yml containing a primary web application and an optional debug-tools service. You want debug-tools to be completely ignored by default when running docker-compose up, but you want the ability to explicitly start it when troubleshooting. Which Docker Compose feature is explicitly designed to handle this scenario?

Writing docker-compose.yml Hard
A. Placing the debug-tools inside an override file and setting depends_on: [].
B. Defining the debug-tools service under a profiles: array (e.g., profiles: ["debug"]).
C. Using the scale: debug-tools=0 default parameter inside the Compose file.
D. Using the restart: never policy on the debug-tools service.

58 A team wishes to leverage Docker Compose to horizontally scale a backend Node.js microservice (docker-compose up --scale backend=5). The backend uses an in-memory cache to store user session tokens. Which of the following issues will occur, and what is the required architectural change to support this scaling?

Advantages: scalability, isolation, agility Hard
A. Docker Compose restricts scaled containers to identical MAC addresses; the architecture must isolate each container into a distinct virtual network.
B. User requests will be routed round-robin to different containers, causing session state to be lost across requests; the architecture must migrate to a centralized caching layer like Redis.
C. The embedded Docker DNS will crash due to multiple identical hostnames; sticky sessions must be implemented at the OS layer.
D. The in-memory cache will automatically synchronize across containers via Docker's overlay network; no architectural change is needed.

59 In a multi-container deployment, the frontend container (React/Nginx) needs to make API calls to the backend container (Express/Node.js). The frontend container is mapped to host port 3000, and the backend is mapped to host port 5000. In the React application code running in the user's browser, which base URL should be used to fetch data from the backend?

Use Case Deployments: Multi-container apps (database + backend + frontend) Hard
A. http://backend:5000/ because Docker's internal DNS automatically resolves the service name for the browser.
B. http://frontend:3000/api/ because React automatically reverse-proxies all requests to connected internal networks.
C. http://localhost:5000/ (or the host's public IP) because the React code executes client-side in the user's browser, outside the Docker network.
D. http://backend:80/ because internal Docker communication bypasses port mappings and requires the default HTTP port.

60 When introducing an API Gateway (like Traefik or Nginx) to a Docker Compose microservices architecture, you decide to implement SSL/TLS termination and JWT token validation directly at the Gateway. What is the primary architectural advantage of this approach?

API Gateway Hard
A. It ensures that internal services automatically encrypt their inter-service HTTP communication via the Gateway's certificate.
B. It eliminates the need for the API Gateway to route traffic, reducing latency between services.
C. It offloads cross-cutting concerns, ensuring internal microservices can remain focused purely on business logic without duplicating security code.
D. It prevents internal microservices from communicating with one another, enforcing strict external-only traffic routing.