A comprehensive Docker-based development environment with modern web stack services.
- Nginx 1.28 - High-performance web server and reverse proxy
- MySQL 8.0 - Reliable relational database
- PostgreSQL 16 - Advanced open-source database
- Redis 7.2 - In-memory data structure store
- Easy Setup - One-command deployment with Docker Compose
- Environment Variables - Secure configuration management
- Production Ready - Optimized configurations for development and production
- Docker (20.10+)
- Docker Compose (2.0+)
-
Clone the repository
git clone https://github.com/dengmengmian/docker-dev-environment.git cd docker-dev-environment -
Configure environment variables
cp .env.example .env # Edit .env with your preferred settings -
Start all services
docker compose up -d
-
Verify services are running
docker compose ps
├── docker/
│ ├── files/ # Service configurations
│ │ ├── nginx/ # Nginx configs
│ │ ├── mysql/ # MySQL configs
│ │ ├── postgres/ # PostgreSQL configs
│ │ └── redis/ # Redis configs
│ ├── data/ # Database data volumes
│ └── logs/ # Service logs
├── app/ # Your application code
├── docker-compose.yml # Service definitions
└── .env.example # Environment template
Create a .env file based on .env.example:
# Database Configuration
MYSQL_ROOT_PASSWORD=your_secure_password
MYSQL_DATABASE=develop
MYSQL_USER=develop
MYSQL_PASSWORD=your_secure_password
POSTGRES_DB=develop
POSTGRES_USER=develop
POSTGRES_PASSWORD=your_secure_password
# Nginx Configuration
NGINX_DOMAIN=local.my.com
# Timezone
TZ=Asia/Shanghai| Service | Port | Description |
|---|---|---|
| Nginx | 80 | Web server |
| MySQL | 3306 | MySQL database |
| PostgreSQL | 5432 | PostgreSQL database |
| Redis | 6380 | Redis cache |
# Start all services
docker compose up -d
# Stop all services
docker compose down
# View logs
docker compose logs -f
# Restart a specific service
docker compose restart nginx
# Rebuild and start
docker compose up -d --buildMySQL:
- Host:
localhost - Port:
3306 - Database:
develop - Username:
develop - Password: (from your .env file)
PostgreSQL:
- Host:
localhost - Port:
5432 - Database:
develop - Username:
develop - Password: (from your .env file)
Redis:
- Host:
localhost - Port:
6380
- All passwords are configurable via environment variables
- Default passwords are provided for development only
- Change all default passwords before production use
- Database data is persisted in Docker volumes
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Join our discussions for community support
- Docker for containerization
- Nginx for web serving
- MySQL and PostgreSQL for databases
- Redis for caching