Run claude code in isolated docker containers. Ideal for operations teams needing to automate tasks with claude code in a secure, containerized environment. Connects to MCP servers like Unsplash, Context7, and Playwright.
git clone https://github.com/icanhasjonas/run-claude-docker.gitRun claude code in isolated docker containers. Ideal for operations teams needing to automate tasks with claude code in a secure, containerized environment. Connects to MCP servers like Unsplash, Context7, and Playwright.
[{"step":"Prepare your Claude code. Ensure it includes MCP server calls (e.g., Unsplash, Context7, Playwright) and handles errors gracefully. Save the code in a file named `claude_task.py`.","tip":"Use `asyncio` for MCP server calls to avoid blocking. Include logging to track progress and errors."},{"step":"Run the Docker container with the `run-claude-docker` skill. Use the following command in your terminal: `docker run --rm -v $(pwd):/app ghcr.io/anthropics/claude-code:latest python /app/claude_task.py`","tip":"The `--rm` flag ensures the container is removed after execution. The `-v` flag mounts your current directory to `/app` in the container for file access."},{"step":"Monitor the output. The container will stream logs to your terminal. Check the generated files (e.g., JSON, images) in your mounted directory.","tip":"For long-running tasks, redirect logs to a file: `docker run --rm -v $(pwd):/app ghcr.io/anthropics/claude-code:latest python /app/claude_task.py > output.log 2>&1`"},{"step":"Review the results. Validate the output files and logs for errors. If the task fails, check the logs for MCP server connection issues or permission errors.","tip":"Use `docker logs <container_id>` to review logs if the container didn't stream output to your terminal."},{"step":"Automate the process. Use this skill in CI/CD pipelines or cron jobs by wrapping the Docker command in a script. Example: `#!/bin/bash\ncd /path/to/task\ndocker run --rm -v $(pwd):/app ghcr.io/anthropics/claude-code:latest python /app/claude_task.py`"}]
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/icanhasjonas/run-claude-dockerCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Run the following Claude code in an isolated Docker container to [DESCRIBE_TASK]. Use the [MCP_SERVER] MCP server for [SPECIFIC_FUNCTION]. Ensure the container is ephemeral and removes itself after execution. Here's the code to run: ```[CLAUDE_CODE]```. Output the results in a structured format and include any logs or errors encountered during execution.
```
Docker Container Execution Report
================================
Task: Scrape 100 high-resolution images from Unsplash matching the query 'sunset over mountains' and save metadata to a JSON file.
MCP Server: Unsplash
Claude Code:
```python
from mcp import ClientSession
import json
async def main():
async with ClientSession() as session:
images = []
for i in range(100):
result = await session.call_tool(
"unsplash_search",
{"query": "sunset over mountains", "page": i+1}
)
images.extend(result['results'])
with open('unsplash_images.json', 'w') as f:
json.dump(images, f)
if __name__ == "__main__":
import asyncio
asyncio.run(main())
```
Execution Log:
- Container ID: a1b2c3d4e5f6
- Image Used: ghcr.io/anthropics/claude-code:latest
- Start Time: 2024-05-20T14:30:22Z
- End Time: 2024-05-20T14:35:47Z
- Duration: 5 minutes 25 seconds
- Exit Code: 0
- Output File: unsplash_images.json (1.2MB, 100 entries)
Sample Metadata:
{
"id": "abc123",
"url": "https://images.unsplash.com/photo-1234567890",
"description": "Sunset over snow-capped mountains",
"author": "Jane Doe",
"downloads": 12456
}
```
Note: The container automatically removed itself after execution. No residual files or processes remained on the host system.AI assistant built for thoughtful, nuanced conversation
Container platform for building, sharing, and running applications
Unlock data insights with interactive dashboards and collaborative analytics capabilities.
The #1 Decentralized ID platform
Enterprise workflow automation and service management platform
Automate your spreadsheet tasks with AI power
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan