{"slug": "claude-code-development-container-multi-language-docker-container-with-dns", "title": "Claude Code Development Container - Multi-language Docker container with DNS filtering", "summary": "A developer published claude-polyglot, a multi-language Docker development container for running Anthropic's Claude Code CLI with DNS filtering enabled by default. The container restricts network access to api.anthropic.com and claude.ai unless the --network flag is passed, and supports mounting Claude configuration and command history along with a --yolo mode that runs claude --dangerously-skip-permissions.", "body_md": "|  | #!/usr/bin/env bash | \n|  | set -euo pipefail | \n|  |  | \n|  | # claude-polyglot: Run the Claude Code Polyglot development container | \n|  | # Usage: claude-polyglot [OPTIONS] | \n|  | # | \n|  | # Options: | \n|  | #   --build         Build the container image before running | \n|  | #   --no-config     Don't mount Claude Code configuration | \n|  | #   --no-history    Don't mount command history | \n|  | #   --network       Disable DNS filtering (allow all network access) | \n|  | #   --yolo          Run claude --dangerously-skip-permissions | \n|  | #   --help          Show this help message | \n|  | # | \n|  | # Examples: | \n|  | #   claude-polyglot                    # Run with DNS filtering (Claude API only) | \n|  | #   claude-polyglot --build            # Rebuild and run | \n|  | #   claude-polyglot --network          # Run with full network access | \n|  | #   claude-polyglot --yolo             # Run Claude without permission checks | \n|  | #   claude-polyglot zsh                # Run with zsh command | \n|  | #   claude-polyglot cargo build        # Run Rust cargo | \n|  | #   claude-polyglot python3 script.py  # Run Python script | \n|  | #   claude-polyglot swipl -s file.pl   # Run Prolog file | \n|  | #   claude-polyglot ruff check .       # Run ruff linter | \n|  | # END_HELP | \n|  |  | \n|  | IMAGE_NAME=\"claude-polyglot:latest\" | \n|  | BUILD=false | \n|  | MOUNT_CONFIG=true | \n|  | MOUNT_HISTORY=true | \n|  | UNRESTRICTED_NETWORK=false | \n|  | YOLO_MODE=false | \n|  | DOCKER_ARGS=() | \n|  | COMMAND_ARGS=() | \n|  |  | \n|  | # Whitelisted domains for DNS filtering | \n|  | WHITELISTED_DOMAINS=( | \n|  | \"api.anthropic.com\" | \n|  | \"claude.ai\" | \n|  | ) | \n|  |  | \n|  | # Parse arguments | \n|  | while [[ $# -gt 0 ]]; do | \n|  | case $1 in | \n|  | --build) | \n|  | BUILD=true | \n|  | shift | \n|  | ;; | \n|  | --no-config) | \n|  | MOUNT_CONFIG=false | \n|  | shift | \n|  | ;; | \n|  | --no-history) | \n|  | MOUNT_HISTORY=false | \n|  | shift | \n|  | ;; | \n|  | --network) | \n|  | UNRESTRICTED_NETWORK=true | \n|  | shift | \n|  | ;; | \n|  | --yolo) | \n|  | YOLO_MODE=true | \n|  | shift | \n|  | ;; | \n|  | --help) | \n|  | sed -n '/^# claude-polyglot:/,/^# END_HELP/p' \"$0\" \\| sed 's/^# //' \\| sed 's/^#$//' \\| grep -v '^END_HELP$' | \n|  | exit 0 | \n|  | ;; | \n|  | *) | \n|  | COMMAND_ARGS+=(\"$1\") | \n|  | shift | \n|  | ;; | \n|  | esac | \n|  | done | \n|  |  | \n|  | # Build if requested | \n|  | if [ \"$BUILD\" = true ]; then | \n|  | SCRIPT_DIR=\"$(cd \"$(dirname \"${BASH_SOURCE[0]}\")\" && pwd)\" | \n|  | echo \"Building $IMAGE_NAME...\" | \n|  | docker build -t \"$IMAGE_NAME\" \"$SCRIPT_DIR\" | \n|  | fi | \n|  |  | \n|  | # Check if image exists | \n|  | if ! docker image inspect \"$IMAGE_NAME\" &>/dev/null; then | \n|  | echo \"Error: Image $IMAGE_NAME not found.\" | \n|  | echo \"Build it with: docker build -t $IMAGE_NAME /path/to/container/polyglot\" | \n|  | echo \"Or run: $(basename \"$0\") --build\" | \n|  | exit 1 | \n|  | fi | \n|  |  | \n|  | # Setup volume mounts | \n|  | DOCKER_ARGS+=( | \n|  | \"-v\" \"$(pwd):/workspace\" | \n|  | ) | \n|  |  | \n|  | if [ \"$MOUNT_CONFIG\" = true ] && [ -d \"$HOME/.claude\" ]; then | \n|  | DOCKER_ARGS+=(\"-v\" \"$HOME/.claude:/home/node/.claude\") | \n|  | fi | \n|  |  | \n|  | if [ \"$MOUNT_HISTORY\" = true ]; then | \n|  | DOCKER_ARGS+=(\"-v\" \"claude-polyglot-history:/commandhistory\") | \n|  | fi | \n|  |  | \n|  | # DNS filtering by default, unrestricted network when --network is specified | \n|  | if [ \"$UNRESTRICTED_NETWORK\" = false ]; then | \n|  | # Enable network but filter DNS - only allow whitelisted domains | \n|  | echo \"Enabling DNS filtering (Claude API access only)...\" | \n|  |  | \n|  | # Resolve whitelisted domains and add as host entries | \n|  | for domain in \"${WHITELISTED_DOMAINS[@]}\"; do | \n|  | # Resolve domain to IP addresses | \n|  | ips=$(dig +short \"$domain\" 2>/dev/null \\| grep -E '^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$') | \n|  |  | \n|  | if [ -n \"$ips\" ]; then | \n|  | # Add first IP as host entry | \n|  | first_ip=$(echo \"$ips\" \\| head -1) | \n|  | DOCKER_ARGS+=(\"--add-host\" \"${domain}:${first_ip}\") | \n|  | echo \"  ✓ ${domain} -> ${first_ip}\" | \n|  | else | \n|  | echo \"  ⚠ Warning: Could not resolve ${domain}\" | \n|  | fi | \n|  | done | \n|  |  | \n|  | # Set DNS to non-existent server to block all other lookups | \n|  | DOCKER_ARGS+=(\"--dns\" \"0.0.0.0\") | \n|  | else | \n|  | echo \"DNS filtering disabled - full network access enabled\" | \n|  | fi | \n|  |  | \n|  | # If no command specified, run interactive shell or Claude in YOLO mode | \n|  | if [ ${#COMMAND_ARGS[@]} -eq 0 ]; then | \n|  | DOCKER_ARGS+=(\"-it\") | \n|  | if [ \"$YOLO_MODE\" = true ]; then | \n|  | COMMAND_ARGS=(\"claude\" \"--dangerously-skip-permissions\") | \n|  | else | \n|  | COMMAND_ARGS=(\"zsh\") | \n|  | fi | \n|  | else | \n|  | # If command is provided, determine if we need interactive mode | \n|  | case \"${COMMAND_ARGS[0]}\" in | \n|  | bash\\|zsh\\|sh\\|claude) | \n|  | DOCKER_ARGS+=(\"-it\") | \n|  | ;; | \n|  | swipl\\|python\\|python3\\|ipython) | \n|  | # Only interactive if no additional arguments | \n|  | if [ ${#COMMAND_ARGS[@]} -eq 1 ]; then | \n|  | DOCKER_ARGS+=(\"-it\") | \n|  | fi | \n|  | ;; | \n|  | esac | \n|  | fi | \n|  |  | \n|  | # Run the container | \n|  | exec docker run --rm \"${DOCKER_ARGS[@]}\" \"$IMAGE_NAME\" \"${COMMAND_ARGS[@]}\" |", "url": "https://wpnews.pro/news/claude-code-development-container-multi-language-docker-container-with-dns", "canonical_source": "https://gist.github.com/mosgaragedev/54863043e8847d35c2e35efe2007c4e9", "published_at": "2026-09-13 21:16:42+00:00", "updated_at": "2026-09-13 21:51:24.520114+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "ai-agents", "ai-products"], "entities": ["Claude Code", "Anthropic", "Docker", "claude-polyglot"], "alternates": {"html": "https://wpnews.pro/news/claude-code-development-container-multi-language-docker-container-with-dns", "markdown": "https://wpnews.pro/news/claude-code-development-container-multi-language-docker-container-with-dns.md", "text": "https://wpnews.pro/news/claude-code-development-container-multi-language-docker-container-with-dns.txt", "jsonld": "https://wpnews.pro/news/claude-code-development-container-multi-language-docker-container-with-dns.jsonld"}}