Docker Quick Start Guide¶
🚀 Get Started in 3 Steps¶
1. Start the Application¶
2. Verify It's Running¶
3. Access the Application¶
- API: http://localhost:8080
- Swagger UI: http://localhost:8080/swagger-ui.html
📋 Common Commands¶
Start & Stop¶
# Start all services
docker-compose up -d
# Stop all services
docker-compose down
# Restart services
docker-compose restart
# Stop and remove volumes (clean slate)
docker-compose down -v
View Logs¶
# All services
docker-compose logs -f
# Application only
docker-compose logs -f app
# Last 100 lines
docker-compose logs --tail=100 app
Check Status¶
# Service status
docker-compose ps
# Resource usage
docker stats
# Health check
curl http://localhost:8080/actuator/health
Rebuild¶
# Rebuild and restart
docker-compose up -d --build
# Force rebuild (no cache)
docker-compose build --no-cache
🔧 Configuration¶
Change Port¶
Edit docker-compose.yml:
Increase Memory¶
Edit docker-compose.yml:
Enable Debug Logging¶
🐛 Troubleshooting¶
Application Won't Start¶
Port Already in Use¶
MongoDB Connection Issues¶
# Test MongoDB
docker-compose exec mongodb mongosh --eval "db.runCommand({ ping: 1 })"
# Restart MongoDB
docker-compose restart mongodb
Clean Everything¶
# Remove all containers, networks, and volumes
docker-compose down -v
# Remove images
docker rmi sprboot-api-cktbrkr:latest
# Start fresh
docker-compose up -d --build
📊 Monitoring¶
Health Checks¶
# Application health
curl http://localhost:8080/actuator/health
# MongoDB health
docker-compose exec mongodb mongosh --eval "db.adminCommand('ping')"
Metrics¶
🔐 Security¶
Change Default Password¶
Edit docker-compose.yml:
Don't Expose MongoDB¶
Edit docker-compose.yml:
📚 More Information¶
- Full documentation: DOCKER.md
- Implementation details: src/main/docs/DOCKER_IMPLEMENTATION.md
- Troubleshooting: See DOCKER.md
Need Help? Check the full DOCKER.md guide for detailed instructions.