This directory contains practical examples for creating custom Claude DevContainer images tailored for specific development stacks. All examples extend from claude-base:latest to ensure compatibility with the Claude Code toolchain.
Path: ruby-rails/
Use Case: Full-stack Ruby web development with Rails 7, PostgreSQL, Redis, and modern tooling
- Ruby 3.2 with rbenv version management
- Rails 7.1+ with Hotwire and modern frontend tools
- Database clients (PostgreSQL, Redis, SQLite)
- RuboCop, RSpec, and development tools
Path: laravel/
Use Case: Modern PHP web development with Laravel 10, Composer, and testing frameworks
- PHP 8.2 with all essential extensions
- Laravel installer and global tools
- Database support (MySQL, PostgreSQL, Redis)
- Xdebug, PHPStan, Laravel Pint for code quality
docs/custom-images/
├── README.md # This file
├── ruby-rails/ # Ruby on Rails development
│ ├── Dockerfile
│ └── README.md
└── laravel/ # Laravel PHP development
├── Dockerfile
└── README.md
- Choose an example that matches your needs
- Copy the Dockerfile to your project
- Modify it for your specific requirements
- Build your custom image:
docker build -t my-custom-claude:latest . - Use with claude-devcontainer:
claude-devcontainer init -s custom # Edit .devcontainer/devcontainer.json to use your image
- Always extend
claude-base:latestfor compatibility - Follow the USER pattern: root for system packages, claude-user for user tools
- Keep images focused: Create specific images for specific use cases
- Use multi-stage builds for complex installations
- System tools → Install as root with apt-get
- User tools → Install as claude-user with curl/wget
- Language packages → Use language-specific managers (pip, npm, cargo, etc.)
- Clean up → Remove package caches to keep images lean
- Preserve existing PATH and extend it
- Use absolute paths for custom tool locations
- Set appropriate permissions for installed files
- Document environment variables in README
- Tag consistently: Use semantic versioning
- Document dependencies: List required external services
- Provide examples: Include sample projects or usage
- Test regularly: Ensure images work across different environments
# Build Rails development environment
docker build -f docs/custom-images/ruby-rails/Dockerfile -t claude-rails:latest .
# Test the Rails environment
docker run --rm claude-rails:latest rails-start
# Use with DevContainer
claude-devcontainer init -s custom
# Edit devcontainer.json: "image": "claude-rails:latest"# Build Laravel development environment
docker build -f docs/custom-images/laravel/Dockerfile -t claude-laravel:latest .
# Test the Laravel environment
docker run --rm claude-laravel:latest laravel-start
# Use with DevContainer
claude-devcontainer init -s custom
# Edit devcontainer.json: "image": "claude-laravel:latest"# Push to company registry
docker tag claude-rails:latest registry.company.com/claude-rails:latest
docker push registry.company.com/claude-rails:latest
# Team uses: "image": "registry.company.com/claude-rails:latest"# Push to GitHub Container Registry
docker tag claude-laravel:latest ghcr.io/username/claude-laravel:latest
docker push ghcr.io/username/claude-laravel:latest
# Others use: "image": "ghcr.io/username/claude-laravel:latest"# Test Rails image
docker run --rm claude-rails:latest ruby --version
docker run --rm claude-rails:latest rails --version
docker run --rm claude-rails:latest bundle --version
# Test Laravel image
docker run --rm claude-laravel:latest php --version
docker run --rm claude-laravel:latest composer --version
docker run --rm claude-laravel:latest laravel --version
# Test base Claude functionality
docker run --rm claude-rails:latest claude --version# Test Rails DevContainer workflow
mkdir test-rails-project && cd test-rails-project
claude-devcontainer init -s custom
# Edit devcontainer.json: "image": "claude-rails:latest"
code .
# Use "Dev Containers: Reopen in Container"
# Test: rails new myapp && cd myapp && rails server
# Test Laravel DevContainer workflow
mkdir test-laravel-project && cd test-laravel-project
claude-devcontainer init -s custom
# Edit devcontainer.json: "image": "claude-laravel:latest"
code .
# Use "Dev Containers: Reopen in Container"
# Test: laravel new myapp && cd myapp && php artisan serveTo add new examples to this collection:
- Create a new directory with a descriptive name
- Include a Dockerfile that extends claude-base:latest
- Add a README.md explaining the use case and tools included
- Include any supporting scripts or configuration files
- Test the image with actual DevContainer usage
- Submit a pull request with your example
If you need help with custom images:
- Check the main README for general DevContainer guidance
- Review existing examples in this directory
- Test with the
claude-base:latestimage first to isolate issues - Use
docker run --rm -it your-image:latest bashto debug interactively
Keep your custom images lean:
# Good: Combine operations and clean up
RUN apt-get update && apt-get install -y \
tool1 \
tool2 \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# Good: Use multi-stage builds for complex installs
FROM claude-base:latest as builder
# ... build steps ...
FROM claude-base:latest
COPY --from=builder /app/built-tool /usr/local/bin/# Avoid: Multiple RUN commands create layers
RUN apt-get update
RUN apt-get install -y tool1
RUN apt-get install -y tool2
RUN rm -rf /var/lib/apt/lists/*