06 / 11

You need to deploy a Node.js application that uses a MongoDB database and a Redis cache. How would you set this up using Docker Compose?

Create a docker-compose.yml defining three services: app (build from Dockerfile, expose app port, set env vars), mongodb (use mongo image, set volumes for data persistence, define healthcheck), and redis (use redis image). Define a custom network so all services can communicate using service names as hostnames. Compose will handle orchestration and dependency management