ProyectoDocker uses a three-tier Docker Compose architecture made up of a React frontend, a Node.js/Express backend, and a MySQL 8.0 database. Each tier runs in its own container, and Docker Compose coordinates how they start, communicate, and share data. Understanding how these services fit together helps you run, troubleshoot, and extend the project.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/jperez77775/ProyectoDocker/llms.txt
Use this file to discover all available pages before exploring further.
Service overview
The three services are defined indocker-compose.yml:
database— MySQL 8.0 container (cv_database), seeded fromdatabase/init.sqlat first bootbackend— Node.js/Express API container (cv_backend), exposes a single/cvendpointfrontend— Nginx container (cv_frontend) that serves the compiled React app
The cv_network bridge network
All three services join a single user-defined bridge network called cv_network:
database — exactly as configured in backend/server.js:
Service-name DNS resolution only works between containers that share the same Docker network. All three services declare
networks: - cv_network, so they can all reach each other by name.Startup ordering
Docker Compose starts the services in dependency order to prevent the backend from crashing before the database is ready to accept connections. 1.database starts first and runs a health check to confirm MySQL is accepting connections:
backend waits for database to be healthy using the service_healthy condition:
frontend starts after backend using a simple dependency (no health check required):
The frontend container itself does not poll the backend at startup. The React app retries the
GET http://localhost:4000/cv request in the browser every 3 seconds until the backend responds successfully.Persistent storage with mysql_data
MySQL data is stored in a named volume so it survives container restarts and re-creations:
mysql_data volume maps to /var/lib/mysql inside the container — MySQL’s default data directory. The init.sql file is mounted into /docker-entrypoint-initdb.d/, which MySQL runs automatically the first time the container starts with an empty data directory. Subsequent starts skip the initialization script because the volume already contains the database files.
To reset the database to its initial state, you must remove the named volume:
docker compose down -v. This deletes all data and forces re-initialization on the next docker compose up.Port mappings
Each service exposes a single port, mapped identically from host to container:| Service | Host port | Container port | Protocol |
|---|---|---|---|
frontend | 3000 | 3000 | HTTP |
backend | 4000 | 4000 | HTTP |
database | 3306 | 3306 | TCP |
docker compose up, you can access the frontend at http://localhost:3000 and the backend API directly at http://localhost:4000/cv.
Restart policy
Thedatabase and backend services both declare restart: always, which instructs Docker to automatically restart them if they exit for any reason — including an unexpected crash or a host reboot.
frontend service does not declare a restart policy, so it starts once and remains in its final state if the Nginx process exits.
The frontend React app calls
http://localhost:4000/cv from the browser, not from inside Docker. This means port 4000 must be published to the host for the frontend to work — even though both containers are on cv_network.Database health check details
The health check on thedatabase service uses mysqladmin ping to verify that MySQL is ready to accept connections:
| Parameter | Value | Meaning |
|---|---|---|
interval | 5s | How often Compose runs the check |
timeout | 5s | How long to wait before counting a check as failed |
retries | 10 | Failed checks before the container is marked unhealthy |