ProyectoDocker is a containerized full-stack application built with a React frontend served by Nginx, a Node.js/Express backend, and a MySQL 8 database. This guide walks you through building your own Docker images, pushing them to Docker Hub, and bringing the entire stack up with a singleDocumentation 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.
docker compose command.
Deploy the stack
Log in to Docker Hub
Authenticate your terminal session with Docker Hub. This allows you to push images to your account.Enter your Docker Hub username and password when prompted. A successful login prints
Login Succeeded.Clean up previous containers and volumes
Remove any running containers and their associated volumes to ensure MySQL starts with a clean state. Skipping this step can cause the database to fail if old volume data is incompatible with the current schema.
Build the backend image
Navigate to the The backend Dockerfile uses
backend/ directory and build the Node.js image. The --no-cache flag forces a clean build so no stale layer is reused.node:20-alpine, installs dependencies with npm install, and starts the server with node server.js on port 4000.Build the frontend image
Navigate to the
frontend/ directory and build the React image. The build uses a multi-stage Dockerfile: the first stage compiles the React app with npm run build, and the second stage copies the static output into an nginx:1.27-alpine image configured to serve on port 3000.Push images to Docker Hub
Upload both images to your Docker Hub account. This makes them available to
docker compose on any machine.Deploy the full stack
Return to the project root and start all three services. The Docker Compose starts three containers:
--pull always flag ensures Docker Compose downloads the latest versions of your images from Docker Hub rather than using any locally cached layers.cv_database (MySQL 8), cv_backend (Node.js on port 4000), and cv_frontend (Nginx on port 3000). The backend waits for the database healthcheck to pass before it starts, so the startup order is automatic.Verify the deployment
After runningdocker compose up, follow these steps to confirm that every service is healthy.
1. Wait for MySQL to initialize
Give MySQL about 45 seconds to process the init.sql file and reach a healthy state. The docker-compose.yml healthcheck pings MySQL every 5 seconds and retries up to 10 times, so the backend will not start until the database is truly ready.
2. Check the backend logs