Can't Connect to http://localhost
- macOS: Look for the Docker icon in the menu bar (top right)
- Windows: Look for the Docker icon in the system tray
- If Docker is not running, start Docker Desktop and wait for it to fully start (whale icon should be still, not animated)
cd "/Volumes/1 TB SSD/Net/NetControlApp"
chmod +x diagnose.sh
./diagnose.shThis will tell you exactly what's wrong.
docker psYou should see three containers running:
netcontrol-frontendnetcontrol-backendnetcontrol-mongodb
If you don't see them, check all containers:
docker ps -a# Frontend logs
docker logs netcontrol-frontend
# Backend logs
docker logs netcontrol-backend
# MongoDB logs
docker logs netcontrol-mongodbSymptoms:
- Error: "port is already allocated"
- "bind: address already in use"
Solution A - Use Different Port:
Edit docker-compose.yml and change the frontend ports from:
frontend:
ports:
- "80:80"To:
frontend:
ports:
- "8080:80"Then restart:
docker-compose down
docker-compose up -dAccess the app at: http://localhost:8080
Solution B - Stop Service Using Port 80:
# Find what's using port 80
sudo lsof -i :80
# Stop Apache (if that's what's running)
sudo apachectl stop
# Or stop nginx
sudo nginx -s stopCheck the logs:
docker-compose logsCommon causes:
- Missing .env file:
cd "/Volumes/1 TB SSD/Net/NetControlApp"
cat > .env << 'EOF'
JWT_SECRET=NetControl2024SecureKeyForYorkCountyAmateurRadioSociety
EOF- MongoDB not starting:
# Remove and recreate
docker-compose down -v
docker-compose up -dCheck backend logs:
docker logs netcontrol-backendCommon fixes:
- Rebuild backend:
docker-compose down
docker-compose up -d --build backend- Check if MongoDB is accessible:
docker exec -it netcontrol-backend ping mongodbThis means the frontend is running but can't reach the backend.
Solution:
# Restart backend
docker-compose restart backend
# Wait 10 seconds, then check
docker logs netcontrol-backendSolution:
# Rebuild frontend
docker-compose down
docker-compose up -d --build frontend
# Clear browser cache
# Then refresh the page (Cmd+Shift+R on Mac, Ctrl+Shift+R on Windows)Complete reset (WARNING: This deletes all data!):
cd "/Volumes/1 TB SSD/Net/NetControlApp"
# Stop and remove everything including data
docker-compose down -v
# Remove images
docker-compose down --rmi all
# Start fresh
docker-compose up -d --build- Stop everything:
cd "/Volumes/1 TB SSD/Net/NetControlApp"
docker-compose down-
Ensure Docker Desktop is running:
- Wait until the whale icon is steady (not animated)
-
Start the services:
docker-compose up -d- Watch the logs:
docker-compose logs -f-
Wait for services to be ready:
- MongoDB: Look for "Waiting for connections"
- Backend: Look for "Server running on port 5000"
- Frontend: Should start nginx
-
Test the application:
- Open http://localhost
- Wait 30-60 seconds on first start (Docker needs to download images)
docker-compose psAll three should show "Up" status.
docker network ls | grep netcontroldocker volume ls | grep netcontrolcurl http://localhost:5000/api/healthShould return: {"status":"OK","message":"Net Control by K4HEF API is running"}
curl -I http://localhostShould return HTTP 200.
cd "/Volumes/1 TB SSD/Net/NetControlApp"
# Save diagnostic info to file
./diagnose.sh > diagnostic-output.txt 2>&1
# View the file
cat diagnostic-output.txt# Enter backend container
docker exec -it netcontrol-backend sh
# Check if node is running
ps aux
# Check environment variables
env | grep MONGODB_URI
# Exit container
exitdocker statsIf Docker is giving you trouble, you can run in development mode:
docker run -d -p 27017:27017 --name netcontrol-mongodb mongo:7cd "/Volumes/1 TB SSD/Net/NetControlApp/backend"
npm install
# Create .env
cat > .env << 'EOF'
PORT=5000
MONGODB_URI=mongodb://localhost:27017/netcontrol
JWT_SECRET=your_secret_key_here
NODE_ENV=development
EOF
npm run devcd "/Volumes/1 TB SSD/Net/NetControlApp/frontend"
npm install
npm run devAccess at: http://localhost:3000
If you've tried everything and it's still not working, gather:
- Output of
./diagnose.sh - Output of
docker-compose logs - Your operating system version
- Docker Desktop version
73! 📻