Skip to content

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 -e flag)

Basic usage

Start ComfyUI in your active environment:

cfd run

Output:

🎮 Starting ComfyUI in environment: my-env

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:

cfd -e my-env run

Or switch environments:

# Set active
cfd use my-env

# Then run
cfd run

Accessing ComfyUI

Once running, open your browser to:

http://localhost:8188

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

^C
✓ ComfyUI stopped

Running in the background

Using &

Run ComfyUI in the background:

cfd run &

To stop:

# Find the process
ps aux | grep ComfyUI

# Kill it
kill <PID>

Using screen

More reliable for long-running sessions:

# Start a screen session
screen -S comfy

# Run ComfyUI
cfd run

# Detach with Ctrl+A, then D

To reattach:

screen -r comfy

To stop:

# Reattach
screen -r comfy

# Press Ctrl+C
# Exit screen
exit

Using tmux

Another option for persistent sessions:

# Start tmux session
tmux new -s comfy

# Run ComfyUI
cfd run

# Detach with Ctrl+B, then D

To reattach:

tmux attach -t comfy

To stop:

# Reattach
tmux attach -t comfy

# Press Ctrl+C
# Exit tmux
exit

Passing arguments to ComfyUI

ComfyDock passes all arguments after run directly to ComfyUI's main.py:

Change port

# Run on port 8080
cfd run --port 8080

Access at: http://localhost:8080

Listen on all interfaces

# Allow external access
cfd run --listen 0.0.0.0

Security

Only use --listen 0.0.0.0 on trusted networks. This exposes ComfyUI to your entire network.

Auto-launch browser

# Open browser automatically
cfd run --auto-launch

Enable CORS

# Allow cross-origin requests
cfd run --enable-cors-header

Disable GPU

# Force CPU-only execution
cfd run --cpu

Useful for testing or if GPU is in use.

Multiple arguments

Combine any ComfyUI arguments:

cfd run --port 8080 --listen 0.0.0.0 --auto-launch

Output:

🎮 Starting ComfyUI in environment: my-env
   Arguments: --port 8080 --listen 0.0.0.0 --auto-launch

ComfyUI arguments

For a full list of ComfyUI arguments, run:

cfd run -- --help
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

# Start, test, stop
cfd run
# Use ComfyUI...
# Ctrl+C when done

Long-running server

# Use screen or tmux
screen -S comfy
cfd run

# Detach: Ctrl+A, D
# ComfyUI keeps running

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:

# Stop ComfyUI (Ctrl+C)

# Repair environment
cfd repair

# Restart ComfyUI
cfd run

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:

See also