Running ComfyUI¶
Learn how to start, stop, and manage the ComfyUI web interface in your environments.
Prerequisites¶
- Environment created —
cfd create my-env - Environment set as active —
cfd use my-env(or use-eflag)
Basic usage¶
Start ComfyUI in your active environment:
Output:
ComfyUI then outputs its startup logs and opens on http://localhost:8188
First run
The first time you run ComfyUI in an environment, it may take a few seconds to initialize. Subsequent runs are faster.
Running in specific environment¶
If you don't have an active environment set:
Or switch environments:
Accessing ComfyUI¶
Once running, open your browser to:
You should see:
- ComfyUI's web interface
- Default workflow loaded
- Node library on the left
- Canvas in the center
Stopping ComfyUI¶
ComfyUI runs in the foreground by default. To stop it:
Press Ctrl+C in the terminal
Running in the background¶
Using &¶
Run ComfyUI in the background:
To stop:
Using screen¶
More reliable for long-running sessions:
To reattach:
To stop:
Using tmux¶
Another option for persistent sessions:
To reattach:
To stop:
Passing arguments to ComfyUI¶
ComfyDock passes all arguments after run directly to ComfyUI's main.py:
Change port¶
Access at: http://localhost:8080
Listen on all interfaces¶
Security
Only use --listen 0.0.0.0 on trusted networks. This exposes ComfyUI to your entire network.
Auto-launch browser¶
Enable CORS¶
Disable GPU¶
Useful for testing or if GPU is in use.
Multiple arguments¶
Combine any ComfyUI arguments:
Output:
ComfyUI arguments
For a full list of ComfyUI arguments, run:
The-- separator tells cfd to pass all remaining arguments to ComfyUI.
Running multiple environments simultaneously¶
You can run different environments on different ports:
# Terminal 1: production on default port
cfd -e production run
# Terminal 2: testing on port 8189
cfd -e testing run --port 8189
# Terminal 3: dev on port 8190
cfd -e dev run --port 8190
Access each at:
- Production:
http://localhost:8188 - Testing:
http://localhost:8189 - Dev:
http://localhost:8190
Resource usage
Running multiple ComfyUI instances simultaneously uses significant GPU memory. You may need to reduce batch sizes or use CPU mode for secondary instances.
Checking logs¶
If ComfyUI fails to start or behaves unexpectedly:
ComfyUI output¶
ComfyUI prints logs directly to your terminal when run in the foreground. Look for:
- Errors during startup — Missing dependencies, port conflicts
- Model loading issues — Missing models, corrupt files
- Custom node errors — Failed imports, missing packages
ComfyDock logs¶
For environment-level issues:
# Show recent logs
cfd logs -n 50
# Show all logs
cfd logs
# Follow logs in real-time
tail -f ~/comfydock/logs/comfydock.log
Common scenarios¶
Quick testing¶
Long-running server¶
Development workflow¶
# Terminal 1: Run ComfyUI
cfd run
# Terminal 2: Make changes, test, commit
cfd node add new-node
# Test in browser...
cfd commit -m "Added new node"
Testing workflow files¶
# Start ComfyUI
cfd run
# Open http://localhost:8188
# Load workflow from ComfyUI/user/default/workflows/
# Make changes in browser
# Save workflow
# Stop ComfyUI (Ctrl+C)
# Check status
cfd status
# Will show modified workflow
# Commit if good
cfd commit -m "Updated workflow"
Troubleshooting¶
Port already in use¶
Symptom: Address already in use error on port 8188
Solutions:
# Find what's using port 8188
lsof -i :8188
# Kill the process
kill <PID>
# Or use a different port
cfd run --port 8189
GPU out of memory¶
Symptom: CUDA out of memory errors
Solutions:
# Force CPU mode
cfd run --cpu
# Or close other GPU applications
# Or reduce batch size in ComfyUI
# Or use a smaller model
Custom nodes not loading¶
Symptom: "Failed to import custom node" in logs
Solutions:
Models not found¶
Symptom: "Model not found" errors in ComfyUI
Solutions:
# Check model symlink
ls -la ~/comfydock/environments/my-env/ComfyUI/models
# Should show symlink to workspace models
# If not, recreate environment or check workspace init
# Sync model index
cfd model index sync
# Check where ComfyUI expects models
# They should be in ~/comfydock/models/<category>/
ComfyUI crashes immediately¶
Symptom: ComfyUI starts then exits with error
Solutions:
# Check environment is synced
cfd status
# Repair if needed
cfd repair
# Check for Python dependency conflicts
cfd py list
# Try running Python directly to see error
cd ~/comfydock/environments/my-env/ComfyUI
~/comfydock/environments/my-env/.venv/bin/python main.py
Can't access from another device¶
Symptom: Can access http://localhost:8188 but not from phone/tablet
Solutions:
# Run with listen flag
cfd run --listen 0.0.0.0
# Find your machine's IP
# macOS/Linux
ifconfig | grep inet
# Then access from other device
http://<your-ip>:8188
Firewall
You may need to allow port 8188 through your firewall for external access.
Next steps¶
Now that ComfyUI is running:
- Check environment status — Monitor changes
- Add custom nodes — Extend functionality
- Manage workflows — Track and version workflows
- Commit changes — Save your configuration
See also¶
- ComfyUI Documentation — Official ComfyUI docs
- CLI Reference — Complete run command documentation
- Troubleshooting — More solutions