This guide covers deploying Claude Code UI in a Docker container connected to the shared_net network with secure authentication and access to the /opt/docker directory.
-
Run the setup script:
cd /opt/docker/claudecodeui ./docker-setup.sh -
Access the application:
- From other containers on
shared_net:http://claudecodeui:3008 - The application will prompt for initial user setup on first access
- From other containers on
If you prefer manual setup, follow these steps:
# Create the shared_net network if it doesn't exist
docker network create shared_net# Copy and customize environment configuration
cp .env.docker .env
# Generate a secure JWT secret
JWT_SECRET=$(openssl rand -base64 32)
sed -i "s/your-super-secure-jwt-secret-change-this-in-production/$JWT_SECRET/" .env# Build the container
docker compose build
# Start the service
docker compose up -d
# Check status
docker compose logs -f claudecodeuiKey environment variables in .env:
# Server configuration
PORT=3008
NODE_ENV=production
# Security (REQUIRED - change these)
JWT_SECRET=your-secure-jwt-secret
API_KEY=optional-api-key-for-additional-security
# Database
DB_PATH=/app/data/auth.db
# File access
HOME=/opt/docker- JWT Authentication: Required for all access - set up during first visit
- Optional API Key: Additional security layer via
X-API-Keyheader - Network Isolation: Only accessible via
shared_netnetwork - File System Sandboxing: Limited to
/opt/dockerdirectory access
/opt/docker:/opt/docker:rw- Full access to the parent Docker workspaceclaudecodeui_data:/app/data- Persistent storage for SQLite database
Add to your reverse proxy configuration:
location /claudecodeui/ {
proxy_pass http://claudecodeui:3008/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
}services:
your-service:
# ... your service config
depends_on:
- claudecodeui
networks:
- shared_net
environment:
- CLAUDE_UI_URL=http://claudecodeui:3008# Check service status
docker compose ps
# View logs
docker compose logs -f claudecodeui
# Monitor resource usage
docker stats claudecodeui# Restart the service
docker compose restart claudecodeui
# Update the application
git pull
docker compose build
docker compose up -d
# Backup database
docker cp claudecodeui:/app/data/auth.db ./auth-backup-$(date +%Y%m%d).db# Check logs for errors
docker compose logs claudecodeui
# Verify network exists
docker network ls | grep shared_net
# Check disk space
df -h# Reset authentication database
docker compose down
docker volume rm claudecodeui_claudecodeui_data
docker compose up -d# Check volume mounts
docker inspect claudecodeui | grep -A 10 "Mounts"
# Verify permissions
docker exec claudecodeui ls -la /opt/docker- Change Default Secrets: Always customize
JWT_SECRETandAPI_KEY - Network Isolation: Service is not exposed to localhost
- User Authentication: Required for all access
- File System Access: Limited to
/opt/dockerdirectory - Regular Updates: Keep the container image updated
✅ Full Claude Code UI functionality
✅ Access to all projects in /opt/docker
✅ WebSocket real-time communication
✅ File editing and management
✅ Git operations
✅ Terminal integration
✅ Progressive Web App features
✅ Mobile responsive interface
The containerized Claude Code UI integrates seamlessly with:
- Nginx Proxy Manager - For SSL termination and routing
- N8N Workflows - For automation integration
- Other Docker services - Via shared_net network
- File-based services - Through
/opt/dockervolume mount
For issues specific to the Docker deployment:
- Check the container logs:
docker compose logs claudecodeui - Verify network connectivity:
docker network inspect shared_net - Test file access:
docker exec claudecodeui ls -la /opt/docker
For application-specific issues, refer to the main README.md file.