How Docker is Used
The build process (deploy-service/src/utils/buildProject.ts:22) follows these steps:
- Create Dockerfile: Generates a Node.js 20 Alpine-based Dockerfile in the project directory
- Build Image:
docker build -t frontend-build-{id} . - Create Container:
docker create --name build-container-{id} - Extract Build Output:
docker cpthe/app/buildor/app/distfolder - Cleanup: Remove container and image
Docker must be installed and the daemon must be running for builds to work.
Installation
- macOS
- Linux (Ubuntu/Debian)
- Linux (CentOS/RHEL)
- Windows
Download Docker Desktop
Download Docker Desktop from docker.com.
Install Docker
- Open the downloaded
.dmgfile - Drag Docker to Applications folder
- Launch Docker from Applications
- Follow the setup wizard
Start Docker
Docker Desktop should start automatically. Look for the Docker icon in the menu bar.
Allow Docker to access your filesystem when prompted.
Post-Installation Setup
Add User to Docker Group (Linux)
Avoid usingsudo for every Docker command:
Configure Docker Daemon
Optimize Docker for build performance:- Linux
- macOS/Windows
Create or edit Restart Docker:
/etc/docker/daemon.json:/etc/docker/daemon.json
Testing Docker for Builds
Test the exact build process used by the platform:If all steps succeed, Docker is correctly configured for the platform’s build process.
Docker Daemon Management
Check Docker Status
Start/Stop Docker
Auto-Start on Boot
- Linux
- macOS/Windows
Monitoring and Cleanup
Monitor Running Builds
Clean Up Build Artifacts
The platform automatically removes containers and images after builds, but orphaned resources can accumulate:Automated Cleanup
Schedule regular cleanup with cron (Linux/macOS):Troubleshooting
Docker Daemon Not Running
Docker Daemon Not Running
Error:
Cannot connect to the Docker daemonSolutions:- Linux
- macOS/Windows
Permission Denied
Permission Denied
Error:
permission denied while trying to connect to the Docker daemon socketSolutions:Build Failed
Build Failed
Error:
Execution error: Command failedSolutions:- Check Docker daemon is running:
docker info - Verify Node.js image is available:
docker pull node:20-alpine - Check disk space:
df -h - View build logs:
docker logs build-container-{id} - Test build manually:
Out of Disk Space
Out of Disk Space
Error:
no space left on deviceSolutions:- Check Docker disk usage:
docker system df - Clean up:
- Increase Docker Desktop disk limit (Settings → Resources → Disk image size)
- Move Docker data directory (Linux):
/etc/docker/daemon.json
Build Timeout
Build Timeout
Symptom: Builds hang indefinitelySolutions:
- Check container status:
docker ps -a | grep build-container - Kill stuck containers:
- Increase timeout in
buildProject.ts(modify exec options) - Check network connectivity for npm install
Cannot Remove Container
Cannot Remove Container
Error:
Error response from daemon: container is runningSolutions:Performance Optimization
Use BuildKit
Enable Docker BuildKit for faster builds:/etc/docker/daemon.json
Allocate More Resources
- macOS/Windows
- Linux
Docker Desktop → Settings → Resources:
- CPUs: Allocate 50-75% of available cores
- Memory: At least 4GB, 8GB recommended
- Swap: 2GB
- Disk: 60GB+ for multiple builds
Cache npm Dependencies
Modify the Dockerfile to cache node_modules:Security Best Practices
Run Rootless Docker
Run Docker daemon as non-root user:
Scan Images for Vulnerabilities
Limit Container Resources
Prevent resource exhaustion:
Use Read-Only Filesystem
Next Steps
Environment Variables
Configure all required environment variables
Quick Start
Start deploying your first project