GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — DesktopCommanderMCP/install-docker.sh at main · ckgerteis/DesktopCommanderMCP Expand file tree/ Copy pathinstall-docker.shMore file actions executable file ·607 lines (530 loc) · 21.5 KB / Copy pathinstall-docker.shFile metadata and controlsexecutable file ·607 lines (530 loc) · 21.5 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 #!/bin/bash # Desktop Commander Docker Installation Script set -e # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' NC='\033[0m' # No Color # Docker image - can be changed to latest DOCKER_IMAGE="mcp/desktop-commander:latest" CONTAINER_NAME="desktop-commander" # Global flag for verbose output VERBOSE=false print_header() { echo echo -e "${BLUE}██████╗ ███████╗███████╗██╗ ██╗████████╗ ██████╗ ██████╗ ██████╗ ██████╗ ███╗ ███╗███╗ ███╗ █████╗ ███╗ ██╗██████╗ ███████╗██████╗${NC}" echo -e "${BLUE}██╔══██╗██╔════╝██╔════╝██║ ██╔╝╚══██╔══╝██╔═══██╗██╔══██╗ ██╔════╝██╔═══██╗████╗ ████║████╗ ████║██╔══██╗████╗ ██║██╔══██╗██╔════╝██╔══██╗${NC}" echo -e "${BLUE}██║ ██║█████╗ ███████╗█████╔╝ ██║ ██║ ██║██████╔╝ ██║ ██║ ██║██╔████╔██║██╔████╔██║███████║██╔██╗ ██║██║ ██║█████╗ ██████╔╝${NC}" echo -e "${BLUE}██║ ██║██╔══╝ ╚════██║██╔═██╗ ██║ ██║ ██║██╔═══╝ ██║ ██║ ██║██║╚██╔╝██║██║╚██╔╝██║██╔══██║██║╚██╗██║██║ ██║██╔══╝ ██╔══██╗${NC}" echo -e "${BLUE}██████╔╝███████╗███████║██║ ██╗ ██║ ╚██████╔╝██║ ╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ╚═╝ ██║██║ ██║██║ ╚████║██████╔╝███████╗██║ ██║${NC}" echo -e "${BLUE}╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═════╝ ╚══════╝╚═╝ ╚═╝${NC}" echo echo -e "${BLUE}🐳 Docker Installation${NC}" echo print_info "Experiment with AI in secure sandbox environment that won't mess up your main computer" echo } print_success() { echo -e "${GREEN}✅ $1${NC}" } print_error() { echo -e "${RED}❌ Error: $1${NC}" >&2 } print_warning() { echo -e "${YELLOW}⚠️ Warning: $1${NC}" } print_info() { echo -e "${BLUE}ℹ️ $1${NC}" } print_verbose() { if [ "$VERBOSE" = true ]; then echo -e "${BLUE}ℹ️ $1${NC}" fi } # Detect OS detect_os() { case "$OSTYPE" in darwin*) OS="macos" ;; linux*) OS="linux" ;; *) print_error "Unsupported OS: $OSTYPE" ; exit 1 ;; esac } # Get Claude config path based on OS get_claude_config_path() { case "$OS" in "macos") CLAUDE_CONFIG="$HOME/Library/Application Support/Claude/claude_desktop_config.json" ;; "linux") CLAUDE_CONFIG="$HOME/.config/claude/claude_desktop_config.json" ;; esac } # Check if Docker is available check_docker() { while true; do if ! command -v docker >/dev/null 2>&1; then print_error "Docker is not installed or not found" echo print_error "Please install Docker first:" case "$OS" in "macos") print_error "• Download Docker Desktop: https://www.docker.com/products/docker-desktop/" ;; "linux") print_error "• Install Docker Engine: https://docs.docker.com/engine/install/" ;; esac echo echo -n "Press Enter when Docker Desktop is running or Ctrl+C to exit: " read -r continue fi if ! docker info >/dev/null 2>&1; then print_error "Docker is installed but not running" echo print_error "Please start Docker Desktop and try again" echo echo -n "Press Enter when Docker Desktop is running or Ctrl+C to exit: " read -r continue fi # If we get here, Docker is working break done print_success "Docker is available and running" } # Pull the Docker image pull_docker_image() { print_info "Pulling latest Docker image (this may take a moment)..." if docker pull "$DOCKER_IMAGE"; then print_success "Docker image ready: $DOCKER_IMAGE" else print_error "Failed to pull Docker image" print_info "Check your internet connection and Docker Hub access" exit 1 fi } # Ask user which folders to mount ask_for_folders() { echo echo -e "${BLUE}📁 Folder Access Setup${NC}" print_info "By default, Desktop Commander will have access to your user folder:" print_info "📂 $HOME" echo echo -n "Press Enter to accept user folder access or 'y' to customize: " read -r response FOLDERS=() if [[ $response =~ ^[Yy]$ ]]; then # Custom folder selection echo print_info "Custom folder selection:" echo -n "Mount your complete home directory ($HOME)? [Y/n]: " read -r home_response case "$home_response" in [nN]|[nN][oO]) print_info "Skipping home directory" ;; *) FOLDERS+=("$HOME") print_success "Added home directory access" ;; esac # Ask for additional folders echo print_info "Add extra folders outside home directory (optional):" while true; do echo -n "Enter folder path (or Enter to finish): " read -r custom_dir if [ -z "$custom_dir" ]; then break fi custom_dir="${custom_dir/#\~/$HOME}" if [ -d "$custom_dir" ]; then FOLDERS+=("$custom_dir") print_success "Added: $custom_dir" else echo -n "Folder doesn't exist. Add anyway? [y/N]: " read -r add_anyway if [[ $add_anyway =~ ^[Yy]$ ]]; then FOLDERS+=("$custom_dir") print_info "Added: $custom_dir (will create if needed)" fi fi done if [ ${#FOLDERS[@]} -eq 0 ]; then echo print_warning "⚠️ No folders selected - Desktop Commander will have NO file access" echo print_info "This means:" echo " • Desktop Commander cannot read or write any files on your computer" echo " • It cannot help with coding projects, file management, or document editing" echo " • It will only work for system commands and package installation" echo " • This makes Desktop Commander much less useful than intended" echo print_info "You probably want to share at least some folder to work with files" print_info "Most users share their home directory: $HOME" echo echo -n "Continue with NO file access? [y/N]: " read -r confirm if [[ ! $confirm =~ ^[Yy]$ ]]; then print_info "Restarting folder selection..." ask_for_folders return fi print_warning "Proceeding with no file access - Desktop Commander will be limited" fi else # Default: use home directory FOLDERS+=("$HOME") print_success "Using default access to your user folder" fi } # Setup essential volumes for maximum persistence setup_persistent_volumes() { print_verbose "🔧 Setting up persistent development environment" # Essential volumes that cover everything a developer needs ESSENTIAL_VOLUMES=( "dc-system:/usr" # All system packages, binaries, libraries "dc-home:/root" # User configs, dotfiles, SSH keys, git config "dc-workspace:/workspace" # Development files and projects "dc-packages:/var" # Package databases, caches, logs ) for volume in "${ESSENTIAL_VOLUMES[@]}"; do volume_name=$(echo "$volume" | cut -d':' -f1) if ! docker volume inspect "$volume_name" >/dev/null 2>&1; then docker volume create "$volume_name" >/dev/null 2>&1 fi done print_verbose "Persistent environment ready - your tools will survive restarts" } # Build Docker run arguments build_docker_args() { print_verbose "Building Docker configuration..." # Start with base arguments (use --rm so containers auto-remove after each use) DOCKER_ARGS=("run" "-i" "--rm") # Add essential persistent volumes for volume in "${ESSENTIAL_VOLUMES[@]}"; do DOCKER_ARGS+=("-v" "$volume") done # Add user folder mounts with absolute path structure for folder in "${FOLDERS[@]}"; do # Remove leading /Users/username or /home/username and keep absolute structure if [[ "$folder" =~ ^/Users/[^/]+(/.+)$ ]]; then # Mac: /Users/john/projects/data → /home/projects/data absolute_path="${BASH_REMATCH[1]}" DOCKER_ARGS+=("-v" "$folder:/home$absolute_path") elif [[ "$folder" =~ ^/home/[^/]+(/.+)$ ]]; then # Linux: /home/john/projects/data → /home/projects/data absolute_path="${BASH_REMATCH[1]}" DOCKER_ARGS+=("-v" "$folder:/home$absolute_path") else # Fallback for other paths - use basename folder_name=$(basename "$folder") DOCKER_ARGS+=("-v" "$folder:/home/$folder_name") fi done # Add the image DOCKER_ARGS+=("$DOCKER_IMAGE") print_verbose "Docker configuration ready" print_verbose "Essential volumes: ${#ESSENTIAL_VOLUMES[@]} volumes" print_verbose "Mounted folders: ${#FOLDERS[@]} folders" print_verbose "Container mode: Auto-remove after each use (--rm)" } # Update Claude desktop config update_claude_config() { print_verbose "Updating Claude Desktop configuration..." # Create config directory if it doesn't exist CONFIG_DIR=$(dirname "$CLAUDE_CONFIG") if [[ ! -d "$CONFIG_DIR" ]]; then mkdir -p "$CONFIG_DIR" print_verbose "Created config directory: $CONFIG_DIR" fi # Create config if it doesn't exist if [[ ! -f "$CLAUDE_CONFIG" ]]; then echo '{"mcpServers": {}}' > "$CLAUDE_CONFIG" print_verbose "Created new Claude config file" fi # Convert DOCKER_ARGS array to JSON format ARGS_JSON="[" for i in "${!DOCKER_ARGS[@]}"; do if [[ $i -gt 0 ]]; then ARGS_JSON+=", " fi ARGS_JSON+="\"${DOCKER_ARGS[$i]}\"" done ARGS_JSON+="]" # Use Python to update JSON (preserves existing MCP servers) python3 -c " import json import sys config_path = '$CLAUDE_CONFIG' docker_args = $ARGS_JSON try: with open(config_path, 'r') as f: config = json.load(f) except: config = {'mcpServers': {}} if 'mcpServers' not in config: config['mcpServers'] = {} # Configure to use docker run with essential volumes config['mcpServers']['desktop-commander'] = { 'command': 'docker', 'args': docker_args } with open(config_path, 'w') as f: json.dump(config, f, indent=2) print('Successfully updated Claude config') " || { print_error "Failed to update Claude config with Python" exit 1 } print_verbose "Updated Claude config: $CLAUDE_CONFIG" print_verbose "Desktop Commander will be available as 'desktop-commander' in Claude" } # Test the persistent setup test_persistence() { print_verbose "Testing persistent container setup..." print_verbose "Testing essential volumes with a temporary container..." # Test that essential paths are available for persistence if docker "${DOCKER_ARGS[@]}" /bin/bash -c " echo 'Testing persistence paths...' mkdir -p /workspace/test echo 'test-data' > /workspace/test/file.txt && echo 'Workspace persistence: OK' touch /root/.test_config && echo 'Home persistence: OK' echo 'Container test completed successfully' " >/dev/null 2>&1; then print_verbose "Essential persistence test passed" print_verbose "Volumes are working correctly" else print_verbose "Some persistence tests had issues (might still work)" fi } # Show container management commands show_management_info() { echo print_success "🎉 Installation successfully completed! Thank you for using Desktop Commander!" echo print_info "How it works:" echo "• Desktop Commander runs in isolated containers" echo "• Your development tools and configs persist between uses" echo "• Each command creates a fresh, clean container" echo print_info "🤔 Need help or have feedback? Happy to jump on a quick call:" echo " https://calendar.app.google/SHMNZN5MJznJWC5A7" echo print_info "💬 Join our community: https://discord.com/invite/kQ27sNnZr7" echo print_info "💡 If you broke the Docker container or need a fresh start:" echo "• Run: $0 --reset && $0" echo "• This will reset everything and reinstall from scratch" } # Reset all persistent data reset_persistence() { echo print_warning "This will remove ALL persistent container data!" echo "This includes:" echo " • All installed packages and software" echo " • All user configurations and settings" echo " • All development projects in /workspace" echo " • All package caches and databases" echo print_info "Your mounted folders will NOT be affected." echo read -p "Are you sure you want to reset everything? [y/N]: " -r case "$REPLY" in [yY]|[yY][eE][sS]) print_info "Cleaning up containers and volumes..." # Stop and remove any containers that might be using our volumes print_verbose "Stopping any running Desktop Commander containers..." docker ps -q --filter "ancestor=$DOCKER_IMAGE" | xargs -r docker stop >/dev/null 2>&1 || true docker ps -a -q --filter "ancestor=$DOCKER_IMAGE" | xargs -r docker rm >/dev/null 2>&1 || true # Also try by container name if it exists docker stop "$CONTAINER_NAME" >/dev/null 2>&1 || true docker rm "$CONTAINER_NAME" >/dev/null 2>&1 || true print_info "Removing persistent volumes..." local volumes=("dc-system" "dc-home" "dc-workspace" "dc-packages") local failed_volumes=() for volume in "${volumes[@]}"; do if docker volume rm "$volume" >/dev/null 2>&1; then print_success "✅ Removed volume: $volume" else failed_volumes+=("$volume") print_warning "⚠️ Volume $volume is still in use or doesn't exist" fi done # If some volumes failed, try harder cleanup if [ ${#failed_volumes[@]} -gt 0 ]; then print_info "Attempting force cleanup of remaining volumes..." # Remove ALL containers that might be holding references (more aggressive) docker container prune -f >/dev/null 2>&1 || true for volume in "${failed_volumes[@]}"; do if docker volume rm "$volume" >/dev/null 2>&1; then print_success "✅ Force removed volume: $volume" else print_error "❌ Could not remove volume: $volume" print_info "Manual cleanup needed: docker volume rm $volume" fi done fi print_success "🎉 Persistent data reset complete!" echo print_info "Run the installer again to create a fresh environment" ;; *) print_info "Reset cancelled" ;; esac } # Show status of current setup show_status() { echo print_header # Check essential volumes local volumes=("dc-system" "dc-home" "dc-workspace" "dc-packages") local volumes_found=0 echo "Essential volumes status:" for volume in "${volumes[@]}"; do if docker volume inspect "$volume" >/dev/null 2>&1; then local mountpoint mountpoint=$(docker volume inspect "$volume" --format '{{.Mountpoint}}' 2>/dev/null || echo "unknown") local size size=$(sudo du -sh "$mountpoint" 2>/dev/null | cut -f1 || echo "unknown") echo " ✅ $volume ($size)" ((volumes_found++)) else echo " ❌ $volume (missing)" fi done echo echo "Status Summary:" echo " Essential volumes: $volumes_found/4 found" echo " Container mode: Auto-remove (--rm)" echo " Persistence: Data stored in volumes" echo if [ "$volumes_found" -eq 4 ]; then echo "✅ Ready to use with Claude!" echo "Each command creates a fresh container that uses your persistent volumes." elif [ "$volumes_found" -gt 0 ]; then echo "⚠️ Some volumes missing - may need to reinstall" else echo "🚀 Run the installer to create your persistent volumes" fi } # Try to restart Claude automatically restart_claude() { print_info "Attempting to restart Claude..." case "$OS" in macos) # Kill Claude if running if pgrep -f "Claude" > /dev/null; then killall "Claude" 2>/dev/null || true sleep 2 print_info "Stopped Claude" fi # Try to start Claude if command -v open &> /dev/null; then if open -a "Claude" 2>/dev/null; then print_success "Claude restarted successfully" else print_warning "Could not auto-start Claude. Please start it manually." fi else print_warning "Could not auto-restart Claude. Please start it manually." fi ;; linux) # Kill Claude if running if pgrep -f "claude" > /dev/null; then pkill -f "claude" 2>/dev/null || true sleep 2 print_info "Stopped Claude" fi # Try to start Claude if command -v claude &> /dev/null; then if claude &>/dev/null & disown; then print_success "Claude restarted successfully" else print_warning "Could not auto-start Claude. Please start it manually." fi else print_warning "Could not auto-restart Claude. Please start it manually." fi ;; esac } # Help message show_help() { print_header echo "Usage: $0 [OPTION]" echo echo "Options:" echo " (no args) Interactive installation" echo " --verbose Show detailed technical output" echo " --reset Remove all persistent data" echo " --status Show current status" echo " --help Show this help" echo echo "Creates a persistent development container using 4 essential volumes:" echo " • dc-system: System packages and binaries (/usr)" echo " • dc-home: User configurations (/root)" echo " • dc-workspace: Development projects (/workspace)" echo " • dc-packages: Package databases and caches (/var)" echo echo "This covers 99% of development persistence needs with simple management." echo } # Main execution logic case "${1:-}" in --reset) print_header reset_persistence exit 0 ;; --status) show_status exit 0 ;; --help) show_help exit 0 ;; --verbose) VERBOSE=true # Continue to main installation flow ;; ""|--install) # Main installation flow ;; *) print_error "Unknown option: $1" echo "Use --help for usage information" exit 1 ;; esac # Main installation flow print_header detect_os print_success "Detected OS: $OS" get_claude_config_path print_info "Claude config path: $CLAUDE_CONFIG" check_docker pull_docker_image ask_for_folders setup_persistent_volumes build_docker_args update_claude_config test_persistence restart_claude echo print_success "✅ Claude has been restarted (if possible)" print_info "Desktop Commander is available as 'desktop-commander' in Claude" echo print_info "Next steps: Install anything you want - it will persist!" echo "• Global packages: npm install -g typescript" echo "• User configs: git config, SSH keys, .bashrc" show_management_info |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |