The database service runs MySQL 8.0 and is the source of truth for all CV data in ProyectoDocker. On the first startup, MySQL automatically runs theDocumentation 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.
init.sql initialization script, which creates the schema and inserts the seed records. Data is stored in a named Docker volume so it persists across container restarts.
Service configuration
| Setting | Value |
|---|---|
| Image | mysql:8.0 |
| Container name | cv_database |
| Host port | 3306 |
| Container port | 3306 |
| Root password | rootpassword |
| Database name | cv_db |
Database schema
Thecv_db database uses the utf8mb4 character set with utf8mb4_spanish_ci collation, which correctly sorts and stores Spanish accented characters.
It contains two tables:
persona
Stores the CV owner’s personal information.
database/init.sql
formacion
Stores the education history, linked to a persona record via a foreign key.
database/init.sql
Seeded data
The initialization script inserts one persona record and five education entries on first startup:database/init.sql
Initialization
Theinit.sql file is mounted into the container at /docker-entrypoint-initdb.d/init.sql via a bind mount in docker-compose.yml:
docker-compose.yml
.sql file placed in /docker-entrypoint-initdb.d/ when the data directory is empty — that is, on the very first startup. If the mysql_data volume already contains data, the script is skipped.
Persistent volume
Themysql_data named volume stores all database files at /var/lib/mysql inside the container. This means your data survives docker compose stop, docker compose down, and container restarts.
Health check
The service declares a health check indocker-compose.yml that polls MySQL until it is ready to accept connections:
docker-compose.yml
The backend service uses
depends_on: database: condition: service_healthy, so Docker will not start the backend container until this health check passes. This prevents the backend from attempting to query the database before MySQL has finished initializing.