Files
Backend-Api/QUICK_REFERENCE.md

3.5 KiB

🚀 Quick Reference - Docker Bind Mounts

Setup (First Time Only)

# Run the setup script
.\setup-bind-mounts.ps1 -GrantFullPermissions

# Or manually create directories
New-Item -ItemType Directory -Force -Path "D:\AppData\Faces"
New-Item -ItemType Directory -Force -Path "D:\AppData\Storage"
New-Item -ItemType Directory -Force -Path "D:\AppData\Logs"

# Grant permissions
icacls "D:\AppData\Faces" /grant Everyone:F /T
icacls "D:\AppData\Storage" /grant Everyone:F /T
icacls "D:\AppData\Logs" /grant Everyone:F /T

Daily Operations

Start Container

docker-compose up -d

Stop Container

docker-compose down

View Logs

docker-compose logs -f
# Or check the host directory
Get-Content D:\AppData\Logs\gozareshgir_log.txt -Tail 50 -Wait

Restart Container

docker-compose restart

Rebuild & Restart

docker-compose down
docker-compose build --no-cache
docker-compose up -d

Verification Commands

Check if directories are mounted

docker exec gozareshgir-servicehost ls -la /app

Test write access from container

docker exec gozareshgir-servicehost sh -c "echo 'test' > /app/Storage/test.txt"
Get-Content D:\AppData\Storage\test.txt
Remove-Item D:\AppData\Storage\test.txt

View mount details

docker inspect gozareshgir-servicehost --format='{{json .Mounts}}' | ConvertFrom-Json | Format-List

Troubleshooting

Permission Issues

# Fix permissions
icacls "D:\AppData\Faces" /grant Everyone:F /T
icacls "D:\AppData\Storage" /grant Everyone:F /T
icacls "D:\AppData\Logs" /grant Everyone:F /T

Check Disk Space

Get-PSDrive D | Select-Object Used,Free,@{Name="FreeGB";Expression={[math]::Round($_.Free/1GB,2)}}

View Container Logs

docker logs gozareshgir-servicehost --tail 100 -f

Backup

Manual Backup

$timestamp = Get-Date -Format "yyyyMMdd_HHmmss"
robocopy "D:\AppData" "D:\Backups\AppData_$timestamp" /MIR /Z

Quick Backup (no mirroring)

robocopy "D:\AppData" "D:\Backups\AppData" /E /Z

Path Mapping Reference

Container Path Windows Host Path Purpose
/app/Faces D:\AppData\Faces Face recognition data
/app/Storage D:\AppData\Storage Uploaded files/documents
/app/Logs D:\AppData\Logs Application logs
/app/certs .\ServiceHost\certs SSL certificates (readonly)

Important Notes

Data is persistent - survives container removal and rebuilds Direct access - files can be accessed directly from Windows Explorer Real-time sync - changes in container appear on host immediately ⚠️ Do not delete - D:\AppData\* directories contain production data ⚠️ Backup regularly - set up scheduled backups for business continuity

Docker Run Alternative

If not using docker-compose:

docker run -d `
  --name gozareshgir-servicehost `
  -p 5003:80 `
  -p 5004:443 `
  -v "D:/AppData/Faces:/app/Faces" `
  -v "D:/AppData/Storage:/app/Storage" `
  -v "D:/AppData/Logs:/app/Logs" `
  -v "${PWD}/ServiceHost/certs:/app/certs:ro" `
  --env-file ./ServiceHost/.env `
  --add-host=host.docker.internal:host-gateway `
  --restart unless-stopped `
  gozareshgir-servicehost:latest

📖 Full documentation: DOCKER_BIND_MOUNTS_SETUP.md