89 lines
1.8 KiB
Markdown
89 lines
1.8 KiB
Markdown
# Docker Troubleshooting Guide
|
|
|
|
## Common Docker Build Issues
|
|
|
|
### 1. Frontend npm ci Error
|
|
**Error**: `npm ci` fails with "missing package-lock.json"
|
|
**Solution**: The Dockerfile has been updated to use `npm install` instead
|
|
```bash
|
|
docker build --no-cache -t test-frontend ./client
|
|
```
|
|
|
|
### 2. Backend Build Dependencies
|
|
**Error**: Native dependencies compilation fails
|
|
**Solution**: The backend includes all necessary build tools
|
|
```bash
|
|
docker build --no-cache -t test-backend ./server
|
|
```
|
|
|
|
### 3. Missing nginx.conf
|
|
**Error**: `nginx.conf` not found during frontend build
|
|
**Solution**: The nginx configuration is now included in the client directory
|
|
```bash
|
|
# Check if nginx.conf exists
|
|
ls client/nginx.conf
|
|
```
|
|
|
|
### 4. Docker Compose Network Issues
|
|
**Error**: Services cannot communicate
|
|
**Solution**: Use the simplified docker-compose file
|
|
```bash
|
|
docker-compose -f docker-compose.simple.yml up -d
|
|
```
|
|
|
|
## Build Testing
|
|
|
|
Test builds individually before running docker-compose:
|
|
|
|
```bash
|
|
# Linux/Mac
|
|
chmod +x test-docker-builds.sh
|
|
./test-docker-builds.sh
|
|
|
|
# Windows
|
|
test-docker-builds.bat
|
|
```
|
|
|
|
## Quick Fixes
|
|
|
|
### Reset Everything
|
|
```bash
|
|
docker-compose down -v
|
|
docker system prune -f
|
|
docker-compose build --no-cache
|
|
docker-compose up -d
|
|
```
|
|
|
|
### Check Service Logs
|
|
```bash
|
|
docker-compose logs backend
|
|
docker-compose logs frontend
|
|
docker-compose logs postgres
|
|
```
|
|
|
|
### Manual Container Testing
|
|
```bash
|
|
# Test backend
|
|
docker run -it --rm -p 3001:3001 drone-backend
|
|
|
|
# Test frontend
|
|
docker run -it --rm -p 3000:80 drone-frontend
|
|
```
|
|
|
|
## Performance Issues
|
|
|
|
### Increase Docker Resources
|
|
- Increase Docker Desktop memory to 4GB+
|
|
- Increase Docker Desktop CPU to 4+ cores
|
|
- Enable Docker BuildKit for faster builds
|
|
|
|
### Build Optimization
|
|
```bash
|
|
# Use BuildKit for faster builds
|
|
export DOCKER_BUILDKIT=1
|
|
docker-compose build
|
|
|
|
# Parallel builds
|
|
docker-compose build --parallel
|
|
```
|