Quick start
Get the application up and running on your local machine in under 5 minutes using Docker Compose. This guide will walk you through the entire process from cloning the repository to accessing the running application.Prerequisites
Before you begin, ensure you have the following installed on your system:- Docker: Version 20.10 or higher (Install Docker)
- Docker Compose: Version 2.0 or higher (usually included with Docker Desktop)
- Git: For cloning the repository
You don’t need Node.js or npm installed locally. Everything runs inside Docker containers.
Getting started
Build and start the application
Use Docker Compose to build the multi-stage Docker image and start the container:This command will:
- Build the React frontend using Node.js 18 Alpine
- Install Express backend dependencies
- Create an optimized production image
- Start the container and expose port 5000
Docker Compose configuration
The application uses a simple Docker Compose setup defined indocker-compose.yml:
docker-compose.yml
- Uses Docker Compose version 3.8
- Builds the image from the Dockerfile in the current directory
- Maps port 5000 from the container to port 5000 on your host machine
- Names the container
miniprojectfor easy reference
Understanding the build process
The Dockerfile uses a three-stage build process to create an optimized production image:Managing the application
Stop the application
To stop the running container, pressCtrl+C in the terminal where Docker Compose is running, or run:
Run in detached mode
To run the application in the background:Rebuild after code changes
If you make changes to the code, rebuild and restart:Troubleshooting
Port 5000 already in use
If you see an error about port 5000 being in use, either:- Stop the application using that port
- Modify
docker-compose.ymlto use a different port:
Container won’t start
Check the container logs:Clean rebuild
To rebuild from scratch without cache:Next steps
Now that you have the application running locally, you can:Explore the Docker setup
Learn about the multi-stage build process and optimization techniques
Set up Jenkins CI/CD
Automate your deployment with Jenkins pipeline