Skip to content

Commit dee6edf

Browse files
ungbclaude
andcommitted
docs: add screenshots and external files support for Docker
Add comprehensive documentation and configuration for working with external files and screenshots in Docker containers, since drag-and-drop doesn't work in containerized environments. Changes: - Add new "Working with External Files and Screenshots" section to README - Update docker-compose.yml to mount ~/claude-screenshots folder - Update volume mounts table to include screenshots directory - Update shell aliases to include screenshots mount - Add practical examples and workflows for file sharing - Include tips for organizing and referencing external files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 388ad62 commit dee6edf

2 files changed

Lines changed: 143 additions & 1 deletion

File tree

README.md

Lines changed: 140 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Run [Claude Code](https://github.com/anthropics/claude-code) CLI in a Docker con
1616
- [Sharing Your Claude Configuration](#sharing-your-claude-configuration)
1717
- [Using a Separate Docker Configuration](#using-a-separate-docker-configuration)
1818
- [Volume Mounts](#volume-mounts)
19+
- [Working with External Files and Screenshots](#working-with-external-files-and-screenshots)
1920
- [Environment Variables](#environment-variables)
2021
- [MCP (Model Context Protocol) Support](#mcp-model-context-protocol-support)
2122
- [Troubleshooting](#troubleshooting)
@@ -174,12 +175,13 @@ docker run -it --rm \
174175
#### Full Configuration (Recommended)
175176

176177
```bash
177-
# Full setup with persistent config, git, and SSH
178+
# Full setup with persistent config, git, SSH, and screenshots
178179
docker run -it --rm \
179180
-v $(pwd):/workspace \
180181
-v ~/.claude:/home/coder/.claude \
181182
-v ~/.ssh:/home/coder/.ssh:ro \
182183
-v ~/.gitconfig:/home/coder/.gitconfig:ro \
184+
-v ~/claude-screenshots:/screenshots \
183185
ungb/claude-code
184186
```
185187

@@ -435,6 +437,139 @@ This approach keeps your local Claude Code setup separate from your Docker setup
435437
| `/home/coder/.ssh` | SSH keys for git operations (read-only) |
436438
| `/home/coder/.gitconfig` | Git configuration (read-only) |
437439
| `/home/coder/.claude.json` | MCP server configurations (read-only) |
440+
| `/screenshots` | Optional: Dedicated folder for screenshots and images (recommended) |
441+
442+
## Working with External Files and Screenshots
443+
444+
**Important**: Drag-and-drop doesn't work when Claude Code runs in a Docker container because it's isolated from your host filesystem. You need to explicitly mount directories to make files accessible.
445+
446+
### Recommended Setup: Dedicated Screenshots Folder
447+
448+
Create a dedicated folder on your host machine for screenshots and images you want to share with Claude Code:
449+
450+
#### Step 1: Create the Screenshots Directory
451+
452+
```bash
453+
# Create a dedicated screenshots folder
454+
mkdir -p ~/claude-screenshots
455+
```
456+
457+
#### Step 2: Mount the Screenshots Folder
458+
459+
**Using docker run:**
460+
461+
```bash
462+
docker run -it --rm \
463+
-v $(pwd):/workspace \
464+
-v ~/.claude:/home/coder/.claude \
465+
-v ~/claude-screenshots:/screenshots \
466+
ungb/claude-code
467+
```
468+
469+
**Using docker-compose:**
470+
471+
Update your `docker-compose.yml` to include the screenshots mount (see example in the repository).
472+
473+
#### Step 3: Add Your Files
474+
475+
```bash
476+
# Copy screenshots or images to the folder
477+
cp ~/Downloads/screenshot.png ~/claude-screenshots/
478+
cp ~/Desktop/diagram.jpg ~/claude-screenshots/
479+
480+
# Or save screenshots directly to this folder using your screenshot tool
481+
```
482+
483+
#### Step 4: Reference Files in Claude Code
484+
485+
Inside Claude Code, reference files using the mounted path:
486+
487+
```
488+
Can you analyze /screenshots/screenshot.png?
489+
```
490+
491+
```
492+
Please review the UI in /screenshots/mockup.png and suggest improvements
493+
```
494+
495+
```
496+
Read the diagram at /screenshots/architecture.jpg and explain the flow
497+
```
498+
499+
### Alternative: Using Your Downloads Folder
500+
501+
You can also mount your Downloads folder directly:
502+
503+
```bash
504+
# Mount Downloads folder (read-only recommended for safety)
505+
docker run -it --rm \
506+
-v $(pwd):/workspace \
507+
-v ~/.claude:/home/coder/.claude \
508+
-v ~/Downloads:/downloads:ro \
509+
ungb/claude-code
510+
```
511+
512+
Then reference files:
513+
514+
```
515+
Analyze /downloads/screenshot.png
516+
```
517+
518+
### Alternative: Copy Files to Your Workspace
519+
520+
If you're working on a specific project, copy files directly into your project directory:
521+
522+
```bash
523+
# Copy to your project directory (which is already mounted as /workspace)
524+
cp ~/Downloads/screenshot.png /path/to/your/project/
525+
526+
# Then in Claude Code:
527+
# Analyze /workspace/screenshot.png
528+
```
529+
530+
### Multiple Mount Points Example
531+
532+
You can mount multiple directories for different purposes:
533+
534+
```bash
535+
docker run -it --rm \
536+
-v $(pwd):/workspace \
537+
-v ~/.claude:/home/coder/.claude \
538+
-v ~/claude-screenshots:/screenshots \
539+
-v ~/Downloads:/downloads:ro \
540+
-v ~/Documents:/docs:ro \
541+
ungb/claude-code
542+
```
543+
544+
This gives you access to:
545+
- `/workspace` - Your current project
546+
- `/screenshots` - Dedicated screenshots folder (read-write)
547+
- `/downloads` - Downloads folder (read-only)
548+
- `/docs` - Documents folder (read-only)
549+
550+
### Tips for Working with External Files
551+
552+
1. **Use descriptive paths**: Instead of `screenshot.png`, use `login-page-error.png`
553+
2. **Organize by purpose**: Create subfolders in `~/claude-screenshots/` like `bugs/`, `designs/`, `diagrams/`
554+
3. **Read-only mounts**: Use `:ro` flag for folders you only need to read from (safety measure)
555+
4. **Absolute paths**: Always use absolute paths when referencing files (e.g., `/screenshots/image.png`)
556+
557+
### Example Workflow
558+
559+
```bash
560+
# 1. Take a screenshot (macOS example)
561+
# Press Cmd+Shift+4 and save to ~/claude-screenshots/
562+
563+
# 2. Start Claude Code with screenshots mounted
564+
docker run -it --rm \
565+
-v $(pwd):/workspace \
566+
-v ~/.claude:/home/coder/.claude \
567+
-v ~/claude-screenshots:/screenshots \
568+
ungb/claude-code
569+
570+
# 3. In Claude Code, reference the screenshot
571+
> Can you analyze the error message in /screenshots/error-screenshot.png and help me fix it?
572+
```
438573

439574
## Environment Variables
440575

@@ -609,10 +744,12 @@ alias claude-docker='docker run -it --rm \
609744
-v ~/.claude:/home/coder/.claude \
610745
-v ~/.ssh:/home/coder/.ssh:ro \
611746
-v ~/.gitconfig:/home/coder/.gitconfig:ro \
747+
-v ~/claude-screenshots:/screenshots \
612748
ungb/claude-code claude'
613749

614750
# Usage (interactive): claude-docker
615751
# Usage (one-shot): claude-docker -p "explain this code"
752+
# Usage (with screenshot): claude-docker -p "analyze /screenshots/bug.png"
616753
```
617754

618755
### For API Key Users
@@ -623,11 +760,13 @@ alias claude-docker='docker run -it --rm \
623760
-v ~/.claude:/home/coder/.claude \
624761
-v ~/.ssh:/home/coder/.ssh:ro \
625762
-v ~/.gitconfig:/home/coder/.gitconfig:ro \
763+
-v ~/claude-screenshots:/screenshots \
626764
-e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \
627765
ungb/claude-code claude'
628766

629767
# Usage (interactive): claude-docker
630768
# Usage (one-shot): claude-docker -p "explain this code"
769+
# Usage (with screenshot): claude-docker -p "analyze /screenshots/bug.png"
631770
```
632771

633772
## Building Locally

docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ services:
1212
- ~/.ssh:/home/coder/.ssh:ro
1313
# Git configuration (read-only)
1414
- ~/.gitconfig:/home/coder/.gitconfig:ro
15+
# Dedicated folder for screenshots and images (recommended)
16+
- ~/claude-screenshots:/screenshots
1517
environment:
1618
# Set your Anthropic API key (not needed if using OAuth)
1719
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-}
@@ -32,6 +34,7 @@ services:
3234
- claude-config:/home/coder/.claude
3335
- ~/.ssh:/home/coder/.ssh:ro
3436
- ~/.gitconfig:/home/coder/.gitconfig:ro
37+
- ~/claude-screenshots:/screenshots
3538
environment:
3639
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
3740
stdin_open: true

0 commit comments

Comments
 (0)