mirror of
https://github.com/johndoe6345789/docker-swarm-termina.git
synced 2026-04-24 13:45:01 +00:00
Problem: CapRover's serviceUpdateOverride in captain-definition doesn't always apply automatically, causing "Docker socket NOT found" errors. Solution: Manual docker service update command to apply the mount. Changes: - Added CAPROVER_TROUBLESHOOTING.md with complete step-by-step fix - Manual docker service update command - Verification steps - Common issues and solutions - SELinux/AppArmor troubleshooting - Created fix-caprover-docker-mount.sh automated script - Finds service automatically - Applies mount - Verifies configuration - Shows service status - Enhanced backend/app.py diagnostics - Lists /var/run directory contents - Shows Docker-related files - Better error messages explaining the issue - Explicit note when mount is missing - Updated backend/requirements.txt - Docker SDK 7.0.0 -> 7.1.0 (fixes URL scheme error) - Updated CAPROVER_DEPLOYMENT.md - Prominent warning about serviceUpdateOverride limitation - New Step 4: Verify and Apply Docker Socket Mount - Quick fix command prominently displayed - Links to troubleshooting guide - Updated troubleshooting section with manual fix - Updated QUICKSTART.md - Warning after backend deployment instructions - Quick fix command for both deployment options - Links to troubleshooting guide This provides users with immediate solutions when encountering the "Cannot connect to Docker" error, which is now properly diagnosed and can be fixed with a single command. https://claude.ai/code/session_01NfGGGQ9Zn6ue7PRZpAoB2N
4.2 KiB
4.2 KiB
Quick Start Guide
Get up and running with Docker Swarm Terminal in minutes.
Prerequisites
- CapRover server set up and running
- CapRover CLI installed:
npm install -g caprover - Git repository cloned locally
Option 1: Deploy from Pre-built Releases (Fastest)
Backend
- Download
releases/backend-caprover-{version}.tarfrom GitHub Releases - In CapRover dashboard:
- Create app named
terminalbackend - Enable HTTPS
- Go to "Deployment" tab
- Upload the
.tarfile (uncompressed - required by CapRover)
- Create app named
- Wait for deployment to complete
- Check logs for:
✓ Docker connection verified on startup
⚠️ IMPORTANT: If you see ✗ Docker socket NOT found, you must manually apply the mount:
# SSH into your CapRover server
ssh root@your-server.com
# Apply the Docker socket mount
docker service update \
--mount-add type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \
srv-captain--terminalbackend
See CAPROVER_TROUBLESHOOTING.md for details.
Frontend
- Download
releases/frontend-caprover-{version}.tarfrom GitHub Releases - In CapRover dashboard:
- Create app named
terminalfrontend - Enable HTTPS
- Set environment variable:
NEXT_PUBLIC_API_URL=https://terminalbackend.yourdomain.com
- Upload the
.tarfile (uncompressed - required by CapRover)
- Create app named
- Visit your frontend URL
Option 2: Deploy from Source (Latest Changes)
Backend
# Login to CapRover
caprover login
# Navigate to backend
cd backend
# Deploy
caprover deploy
# Check logs
caprover logs terminalbackend --follow
⚠️ IMPORTANT: If logs show ✗ Docker socket NOT found, manually apply the mount on your CapRover server:
docker service update \
--mount-add type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \
srv-captain--terminalbackend
Frontend
cd frontend
caprover deploy
Verification
Backend Health Check
curl https://terminalbackend.yourdomain.com/api/health
# Should return: {"status":"healthy"}
Login Test
curl -X POST https://terminalbackend.yourdomain.com/api/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"admin123"}'
Container List
# Use the token from login response
curl https://terminalbackend.yourdomain.com/api/containers \
-H "Authorization: Bearer {your-token}"
Troubleshooting
"Cannot connect to Docker" Error
-
Check backend logs in CapRover dashboard
-
Look for diagnostic output:
=== Docker Environment Diagnosis === -
Verify:
- Socket exists:
✓ Docker socket exists - Permissions:
Readable: True, Writable: True - User:
Current user: root
- Socket exists:
-
If socket not found or not writable:
- Ensure
captain-definitionhas correctserviceUpdateOverride - Redeploy the app (may need to delete and recreate)
- Ensure
Frontend Can't Connect to Backend
- Verify backend URL in frontend environment variables
- Check CORS is enabled (it should be by default)
- Ensure both apps have HTTPS enabled
- Check browser console for errors
Container List Empty
- Verify Docker is running on CapRover host
- Check if user has permission to see containers
- Try running:
docker pson the host machine
Security
Important: Change default credentials!
- In CapRover dashboard, go to backend app
- Set environment variables:
ADMIN_USERNAME=your_usernameADMIN_PASSWORD=your_secure_password
- Restart the app
Next Steps
- Read CAPROVER_DEPLOYMENT.md for detailed configuration
- Review backend/README.md for API documentation
- Check frontend/README.md for frontend details
- Customize the interface and add features
Getting Help
If you encounter issues:
- Check application logs (most diagnostic info is there)
- Review CAPROVER_DEPLOYMENT.md troubleshooting section
- Ensure CapRover and Docker are up to date
- Open an issue with logs and diagnostic output