Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available:
6.0.2
Docker Commands for IntegraChat
Quick Start Commands
1. Stop and Remove Existing Container
docker rm -f integrachat
2. Build the Docker Image
docker build -t integrachat:latest .
3. Run the Container
docker run -d --name integrachat `
-p 7860:7860 `
-p 8000:8000 `
-p 8900:8900 `
--env-file .env `
-e DOCKER_CONTAINER=1 `
integrachat:latest
4. View Logs
# Follow logs (live)
docker logs -f integrachat
# Last 50 lines
docker logs --tail 50 integrachat
# Last 100 lines with timestamps
docker logs --tail 100 -t integrachat
Container Management
Check Container Status
# Check if running
docker ps --filter "name=integrachat"
# Check all containers (including stopped)
docker ps -a --filter "name=integrachat"
# Detailed status
docker ps --filter "name=integrachat" --format "Container: {{.Names}} | Status: {{.Status}} | Ports: {{.Ports}}"
Stop Container
docker stop integrachat
Start Container (if stopped)
docker start integrachat
Restart Container
docker restart integrachat
Remove Container
# Stop and remove
docker rm -f integrachat
# Remove only if stopped
docker rm integrachat
Image Management
List Images
docker images integrachat
Remove Image
docker rmi integrachat:latest
Rebuild Without Cache
docker build --no-cache -t integrachat:latest .
Debugging Commands
Execute Commands Inside Container
# Open shell in container
docker exec -it integrachat /bin/bash
# Run Python command
docker exec integrachat python --version
# Check environment variables
docker exec integrachat printenv | Select-String -Pattern "GROQ|MCP|API"
# Check if services are running
docker exec integrachat ps aux
Check Service Health
# Check FastAPI health
docker exec integrachat curl -s http://localhost:8000/health
# Check MCP server health
docker exec integrachat curl -s http://localhost:8900/health
# Check Gradio (from host)
Invoke-WebRequest -Uri http://localhost:7860 -UseBasicParsing -TimeoutSec 5
View Service Logs
# FastAPI logs
docker exec integrachat tail -n 50 /app/logs/fastapi.log
# MCP server logs
docker exec integrachat tail -n 50 /app/logs/mcp.log
# Gradio logs
docker exec integrachat tail -n 50 /app/logs/gradio.log
# All logs
docker exec integrachat tail -n 50 /app/logs/*.log
Check Ports
# Check what ports are mapped
docker port integrachat
# Check if ports are listening (from host)
netstat -an | Select-String -Pattern "7860|8000|8900"
Complete Rebuild Sequence
# 1. Stop and remove container
docker rm -f integrachat
# 2. Remove old image (optional)
docker rmi integrachat:latest
# 3. Build new image
docker build -t integrachat:latest .
# 4. Run container
docker run -d --name integrachat `
-p 7860:7860 `
-p 8000:8000 `
-p 8900:8900 `
--env-file .env `
-e DOCKER_CONTAINER=1 `
integrachat:latest
# 5. Check status
docker ps --filter "name=integrachat"
# 6. View logs
docker logs -f integrachat
Quick Health Check
# Check all services
Write-Host "Container Status:" -ForegroundColor Cyan
docker ps --filter "name=integrachat" --format " {{.Names}}: {{.Status}}"
Write-Host "`nService Health:" -ForegroundColor Cyan
Write-Host " FastAPI:" -NoNewline
docker exec integrachat curl -s http://localhost:8000/health 2>&1 | Out-Null
if ($LASTEXITCODE -eq 0) { Write-Host " β Running" -ForegroundColor Green } else { Write-Host " β Not responding" -ForegroundColor Red }
Write-Host " MCP Server:" -NoNewline
docker exec integrachat curl -s http://localhost:8900/health 2>&1 | Out-Null
if ($LASTEXITCODE -eq 0) { Write-Host " β Running" -ForegroundColor Green } else { Write-Host " β Not responding" -ForegroundColor Red }
Write-Host " Gradio UI:" -NoNewline
try { $response = Invoke-WebRequest -Uri http://localhost:7860 -UseBasicParsing -TimeoutSec 2; Write-Host " β Running" -ForegroundColor Green } catch { Write-Host " β Not responding" -ForegroundColor Red }
Access URLs
Once the container is running, access:
- Gradio UI: http://localhost:7860
- FastAPI API: http://localhost:8000
- API Docs: http://localhost:8000/docs
- MCP Server: http://localhost:8900
- MCP Server Docs: http://localhost:8900/docs
Troubleshooting
Container won't start
# Check logs for errors
docker logs integrachat
# Check if ports are already in use
netstat -an | Select-String -Pattern "7860|8000|8900"
Services not responding
# Restart container
docker restart integrachat
# Check service logs inside container
docker exec integrachat tail -n 100 /app/logs/*.log
Clear everything and start fresh
# Stop and remove container
docker rm -f integrachat
# Remove image
docker rmi integrachat:latest
# Clear build cache (optional)
docker builder prune -f
# Rebuild from scratch
docker build --no-cache -t integrachat:latest .
Environment Variables
Make sure your .env file has:
GROQ_API_KEY- Your Groq API keyGROQ_MODEL- Model name (default: llama-3.1-8b-instant)RAG_MCP_URL- http://localhost:8900/ragWEB_MCP_URL- http://localhost:8900/webADMIN_MCP_URL- http://localhost:8900/adminMCP_PORT- 8900API_PORT- 8000POSTGRESQL_URL- Your database connection string (optional)