From 6b0828538d1e4dd21e68da61d47f0db63068e2a2 Mon Sep 17 00:00:00 2001 From: Austin Gregg-Smith Date: Tue, 27 Jan 2026 18:57:49 +0000 Subject: [PATCH 1/7] Add spec for rockerc.yaml examples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Addresses issue #120 by creating a specification for comprehensive example configuration files that demonstrate YAML syntax, available options, and common use cases. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- specs/24/yaml-examples/plan.md | 73 ++++++++++++++++++++++++++++++++++ specs/24/yaml-examples/spec.md | 11 +++++ 2 files changed, 84 insertions(+) create mode 100644 specs/24/yaml-examples/plan.md create mode 100644 specs/24/yaml-examples/spec.md diff --git a/specs/24/yaml-examples/plan.md b/specs/24/yaml-examples/plan.md new file mode 100644 index 0000000..f029b64 --- /dev/null +++ b/specs/24/yaml-examples/plan.md @@ -0,0 +1,73 @@ +# Implementation Plan for rockerc.yaml Examples + +## Files to Create + +### 1. examples/ Directory Structure +Create a new `examples/` directory at the project root containing: + +- `examples/basic.yaml` - Simple configuration with image and common extensions +- `examples/advanced.yaml` - Complex configuration with multiple features +- `examples/dockerfile.yaml` - Using a Dockerfile instead of an image +- `examples/global-config.yaml` - Example for ~/.rockerc.yaml +- `examples/vscode.yaml` - VS Code specific configuration +- `examples/blacklist.yaml` - Demonstrating extension-blacklist feature +- `examples/README.md` - Comprehensive documentation of syntax and options + +### 2. Documentation Updates +- Update main README.md to reference examples +- Add detailed configuration reference to examples/README.md + +## Configuration Options to Document + +### Required Fields +- `image`: Docker image to use (e.g., `ubuntu:24.04`) +- `dockerfile`: Alternative to image - path to Dockerfile + +### Args Field +- List of rocker extensions to enable +- Common extensions: x11, user, pull, git, cwd, nvidia, cuda, etc. +- Custom extensions available through rocker plugins + +### Optional Fields +- `name`: Container name +- `image-name`: Image name for the built image +- `volume`: Custom volume mounts (format: `HOST:CONTAINER:OPTIONS`) +- `extension-blacklist`: List of extensions to exclude + +### CLI Integration +- How CLI arguments merge with YAML config +- CLI extensions append to config extensions +- CLI image overrides config image + +## Examples to Create + +### Basic Example +Simple dev container with common tools + +### Advanced Example +Full-featured setup with: +- GPU support (nvidia) +- X11 forwarding +- Custom volume mounts +- Git integration +- Multiple dev tools + +### Dockerfile Example +Using a custom Dockerfile instead of a base image + +### Global Config Example +System-wide defaults in ~/.rockerc.yaml + +### VS Code Example +Configuration optimized for VS Code devcontainer workflow + +### Blacklist Example +Show how to exclude unwanted extensions from global config + +## Implementation Steps +1. Create examples/ directory +2. Write each example YAML file with inline comments +3. Create examples/README.md with comprehensive documentation +4. Update main README.md to reference examples +5. Test each example to ensure they work +6. Run CI to validate diff --git a/specs/24/yaml-examples/spec.md b/specs/24/yaml-examples/spec.md new file mode 100644 index 0000000..efe806f --- /dev/null +++ b/specs/24/yaml-examples/spec.md @@ -0,0 +1,11 @@ +# Add Example rockerc.yaml Files + +**Spec:** +- Create comprehensive example rockerc.yaml files demonstrating various configurations +- Document the YAML syntax and structure +- Show how rocker CLI arguments translate to YAML configuration +- Include examples for common use cases (basic, advanced, global config) +- Document quirks and limitations +- Update README.md with links to examples + +**Addresses:** Issue #120 From ae4d0868917ef63650d6e54bc5985997b12dd76d Mon Sep 17 00:00:00 2001 From: Austin Gregg-Smith Date: Tue, 27 Jan 2026 19:01:01 +0000 Subject: [PATCH 2/7] Add comprehensive rockerc.yaml examples and documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Created examples/ directory with 6 example configurations: * basic.yaml - Simple starter configuration * advanced.yaml - Feature-rich development setup * dockerfile.yaml - Using custom Dockerfile * global-config.yaml - System-wide defaults * vscode.yaml - VS Code optimized configuration * blacklist.yaml - Extension exclusion patterns - Added comprehensive examples/README.md documenting: * Complete configuration syntax reference * All available extensions and their purposes * Configuration hierarchy and merge behavior * CLI integration and override patterns * Common development patterns * Troubleshooting guide - Updated main README.md with links to examples Addresses issue #120 by providing clear documentation of YAML syntax, demonstrating how rocker CLI arguments translate to YAML configuration, and documenting quirks and limitations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- README.md | 19 ++ examples/README.md | 420 ++++++++++++++++++++++++++++++++++++ examples/advanced.yaml | 35 +++ examples/basic.yaml | 18 ++ examples/blacklist.yaml | 37 ++++ examples/dockerfile.yaml | 30 +++ examples/global-config.yaml | 30 +++ examples/vscode.yaml | 37 ++++ 8 files changed, 626 insertions(+) create mode 100644 examples/README.md create mode 100644 examples/advanced.yaml create mode 100644 examples/basic.yaml create mode 100644 examples/blacklist.yaml create mode 100644 examples/dockerfile.yaml create mode 100644 examples/global-config.yaml create mode 100644 examples/vscode.yaml diff --git a/README.md b/README.md index c5902c1..d3d87f3 100644 --- a/README.md +++ b/README.md @@ -150,3 +150,22 @@ dockerfile: Dockerfile ``` will look for the dockerfile relative to the rockerc.yaml file + +## Configuration Examples + +For comprehensive examples and detailed documentation of all configuration options, see the [examples/](examples/) directory: + +- **[examples/basic.yaml](examples/basic.yaml)** - Simple starter configuration +- **[examples/advanced.yaml](examples/advanced.yaml)** - Feature-rich development setup +- **[examples/dockerfile.yaml](examples/dockerfile.yaml)** - Using a custom Dockerfile +- **[examples/global-config.yaml](examples/global-config.yaml)** - System-wide defaults +- **[examples/vscode.yaml](examples/vscode.yaml)** - VS Code optimized setup +- **[examples/blacklist.yaml](examples/blacklist.yaml)** - Excluding extensions +- **[examples/README.md](examples/README.md)** - Complete configuration reference + +These examples demonstrate: +- Available rocker extensions and how to use them +- Configuration field syntax and options +- How global and project configs merge +- CLI integration and override behavior +- Common development patterns and use cases diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..2a83092 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,420 @@ +# rockerc.yaml Configuration Guide + +This directory contains example `rockerc.yaml` configuration files that demonstrate how to use rockerc with various setups and features. + +## Quick Start + +1. Copy one of the example files to your project directory as `rockerc.yaml` +2. Customize the `image` and `args` to match your needs +3. Run `rockerc` in that directory + +```bash +# Copy basic example +cp examples/basic.yaml ./rockerc.yaml + +# Run rockerc +rockerc +``` + +## Available Examples + +- **[basic.yaml](basic.yaml)** - Simple configuration with common extensions +- **[advanced.yaml](advanced.yaml)** - Complex setup with multiple features +- **[dockerfile.yaml](dockerfile.yaml)** - Using a custom Dockerfile instead of an image +- **[global-config.yaml](global-config.yaml)** - System-wide defaults for `~/.rockerc.yaml` +- **[vscode.yaml](vscode.yaml)** - VS Code dev container optimized configuration +- **[blacklist.yaml](blacklist.yaml)** - Excluding unwanted extensions + +## Configuration Syntax + +### Basic Structure + +```yaml +# Required: Specify either 'image' or 'dockerfile' +image: ubuntu:24.04 + +# Required: List of rocker extensions to enable +args: + - x11 + - user + - git +``` + +### Configuration Fields + +#### `image` (string, required unless using `dockerfile`) +The base Docker image to use. + +```yaml +image: ubuntu:24.04 +image: nvidia/cuda:12.0.0-base-ubuntu22.04 +image: ros:jazzy +``` + +#### `dockerfile` (string, alternative to `image`) +Path to a Dockerfile to build instead of using a pre-built image. Path is relative to the location of `rockerc.yaml`. + +```yaml +dockerfile: ./Dockerfile +dockerfile: ./docker/Dockerfile.dev +``` + +**Note:** When using `dockerfile`, the `pull` extension is automatically removed since you're building locally. + +#### `args` (list, required) +List of rocker extensions to enable. Each extension adds functionality to your container. + +```yaml +args: + - x11 # X11 forwarding for GUI apps + - user # Match host user/group IDs + - nvidia # NVIDIA GPU support +``` + +See [Available Extensions](#available-extensions) below for a complete list. + +#### `name` (string, optional) +Custom container name. If not specified, rockerc generates a name based on the project directory. + +```yaml +name: my-dev-container +``` + +#### `image-name` (string, optional) +Custom name for the built image (when using rocker). + +```yaml +image-name: my-custom-image +``` + +#### `volume` (string, optional) +Additional volume mounts in Docker format: `HOST_PATH:CONTAINER_PATH[:OPTIONS]` + +```yaml +volume: ~/.ssh:/root/.ssh:ro +volume: /data:/workspace/data +``` + +For multiple volumes, you can use YAML multi-line: +```yaml +volume: | + ~/.ssh:/root/.ssh:ro + /data:/workspace/data +``` + +Or pass via CLI: `rockerc --volume ~/.ssh:/root/.ssh:ro --volume /data:/workspace/data` + +#### `extension-blacklist` (list, optional) +List of extensions to exclude, even if they appear in global config or merged args. + +```yaml +extension-blacklist: + - nvidia # Disable GPU support + - x11 # Disable X11 for headless container +``` + +## Available Extensions + +Common rocker extensions you can use in `args`: + +### Display & GUI +- `x11` - X11 forwarding for GUI applications +- `nvidia` - NVIDIA GPU support with display capabilities + +### User & Permissions +- `user` - Create a user matching your host user/group ID +- `user-preserve-home` - Preserve home directory structure +- `privileged` - Run container in privileged mode (use with caution) + +### Development Tools +- `git` - Install and configure git with host credentials +- `ssh` - SSH integration +- `dev-helpers` - Development tools (emacs, byobu) +- `deps` - Common system dependencies +- `deps-devtools` - Developer productivity tools (ripgrep, fd-find, fzf) +- `curl` - Install curl +- `nvim` - Install Neovim + +### Package Managers +- `pixi` - Install pixi package manager +- `uv` - Install uv Python package manager +- `conda` - Install Miniconda +- `npm` - Install Node.js and npm +- `cargo` - Install Rust and Cargo +- `homebrew` - Install Homebrew + +### Container Features +- `pull` - Pull latest image before running +- `detach` - Run container in detached mode +- `cwd` - Mount current working directory at ~/project_name +- `auto` - Automatically discover and mount workspace + +### GPU & Compute +- `nvidia` - NVIDIA GPU support +- `cuda` - Install CUDA and nvidia-cuda-dev + +### AI Development Tools +- `claude` - Install Claude Code CLI +- `codex` - Install OpenAI Codex CLI +- `gemini` - Install Gemini CLI + +### Other Extensions +- `ccache` - Install ccache and share cache with host +- `locales` - Configure locales +- `tzdata` - Configure timezone +- `pulse` - PulseAudio support +- `home` - Mount home directory + +For a complete and up-to-date list, run: +```bash +rocker --help +``` + +## Configuration Hierarchy + +rockerc supports two configuration locations that are merged: + +1. **Global config**: `~/.rockerc.yaml` - System-wide defaults +2. **Project config**: `./rockerc.yaml` - Project-specific settings + +### Merge Behavior + +- **`args` field**: Lists are merged and deduplicated (global + project) +- **Other fields**: Project config overrides global config +- **`extension-blacklist`**: Lists are merged to exclude extensions from either source + +### Example: Global + Project Config + +**~/.rockerc.yaml** (global): +```yaml +args: + - x11 + - user + - git + - dev-helpers +``` + +**./rockerc.yaml** (project): +```yaml +image: ubuntu:24.04 +args: + - nvidia + - cuda + - pixi +``` + +**Result**: Final args are `[x11, user, git, dev-helpers, nvidia, cuda, pixi]` + +### Using Blacklist + +**~/.rockerc.yaml** (global): +```yaml +args: + - x11 + - user + - git + - nvidia +``` + +**./rockerc.yaml** (project): +```yaml +image: ubuntu:24.04 +args: + - pixi +extension-blacklist: + - nvidia # Don't need GPU for this project + - x11 # Headless container +``` + +**Result**: Final args are `[user, git, pixi]` + +## CLI Integration + +rockerc accepts additional arguments that merge with or override the YAML config: + +### Adding Extensions via CLI +```bash +# Add nvidia extension to config args +rockerc nvidia + +# Add multiple extensions +rockerc nvidia cuda +``` + +### Overriding Image +```bash +# Override the image specified in rockerc.yaml +rockerc -- ubuntu:22.04 +``` + +### Passing Additional Options +```bash +# Pass arbitrary rocker/docker options +rockerc --env MY_VAR=value --port 8080:8080 + +# With image override +rockerc --env MY_VAR=value -- ubuntu:24.04 +``` + +### VS Code Integration +```bash +# Launch container and attach VS Code +rockerc --vsc + +# Or use the alias +rockervsc + +# Force recreate container +rockerc --vsc --force +``` + +## Common Patterns + +### Minimal Dev Container +```yaml +image: ubuntu:24.04 +args: + - user + - pull + - git + - cwd +``` + +### Python Development +```yaml +image: python:3.12 +args: + - user + - pull + - git + - cwd + - uv + - pixi +``` + +### NVIDIA GPU Development +```yaml +image: nvidia/cuda:12.0.0-base-ubuntu22.04 +args: + - nvidia + - x11 + - user + - pull + - git + - cwd +``` + +### ROS Development +```yaml +image: ros:jazzy +args: + - nvidia + - x11 + - user + - pull + - git + - cwd + - dev-helpers +``` + +### AI/ML Development with Claude Code +```yaml +image: ubuntu:24.04 +args: + - nvidia + - cuda + - user + - pull + - git + - cwd + - claude + - pixi + - uv +``` + +## Quirks and Limitations + +### 1. Extension Order +Most extensions are order-independent, but some have requirements: +- `cache-perms` must run before extensions that mount subdirectories under `.cache` (like `claude`) + +### 2. Dockerfile + Pull +When using `dockerfile`, the `pull` extension is automatically removed since you're building locally. + +### 3. Detached Mode +rockerc always runs containers in detached mode and attaches via `docker exec` for better reliability. + +### 4. Container Naming +If you don't specify a `name`, rockerc generates one based on your project directory. This ensures consistent container names across runs. + +### 5. Workspace Mounting +With `--vsc` or `rockervsc`, the workspace is always mounted at `/workspaces/` to match VS Code's expectations. + +### 6. Environment Variables in Config +You can use environment variables in the YAML: +```yaml +name: '"$CONTAINER_NAME"' +volume: '"${PWD}":/workspaces/"${CONTAINER_NAME}":Z' +``` + +### 7. YAML Indentation +Ensure consistent indentation for list items: + +❌ **Incorrect**: +```yaml +args: + - x11 + - user # Inconsistent indentation +``` + +✅ **Correct**: +```yaml +args: + - x11 + - user +``` + +## Troubleshooting + +### "No rockerc.yaml found" +Make sure you have a `rockerc.yaml` file in the current directory or set up a global `~/.rockerc.yaml`. + +### "No 'args' key found" +The `args` field is required. Add at least one extension: +```yaml +args: + - user +``` + +### Extensions Not Working +- Check that the extension name is spelled correctly +- Run `rocker --help` to see all available extensions +- Some extensions require specific base images (e.g., `nvidia` needs NVIDIA drivers) + +### YAML Parsing Errors +- Check for consistent indentation (use spaces, not tabs) +- Ensure list items start with `- ` +- Validate your YAML syntax with a YAML validator + +### Container Already Exists +If you want to recreate a container: +```bash +rockerc --force +``` + +Or manually remove it: +```bash +docker rm -f +rockerc +``` + +## Additional Resources + +- [rockerc README](../README.md) - Main project documentation +- [rocker GitHub](https://github.com/osrf/rocker) - Underlying rocker tool +- [rocker extensions](https://github.com/osrf/rocker) - Extension documentation +- [Issue #120](https://github.com/blooop/rockerc/issues/120) - Original feature request + +## Contributing + +Found an issue or want to add more examples? Please [open an issue](https://github.com/blooop/rockerc/issues) or submit a pull request! diff --git a/examples/advanced.yaml b/examples/advanced.yaml new file mode 100644 index 0000000..529201d --- /dev/null +++ b/examples/advanced.yaml @@ -0,0 +1,35 @@ +# Advanced rockerc.yaml Example +# +# This example demonstrates a more complex configuration with multiple +# extensions and custom options commonly used in development workflows. +# +# Equivalent rocker command: +# rocker --nvidia --x11 --user --pull --git --cwd --pixi --uv \ +# --deps --dev-helpers --volume ~/.ssh:/root/.ssh:ro \ +# --name my-dev-container -- ubuntu:24.04 + +# Base Docker image +image: ubuntu:24.04 + +# Container name (optional) +# If not specified, rockerc generates a name based on the project directory +name: my-dev-container + +# Custom volume mounts (optional) +# Format: HOST_PATH:CONTAINER_PATH[:OPTIONS] +volume: ~/.ssh:/root/.ssh:ro + +# Comprehensive list of development extensions +args: + - nvidia # Enable NVIDIA GPU support + - x11 # X11 forwarding for GUI applications + - user # Match host user inside container + - pull # Pull latest image version + - git # Git integration with host config + - cwd # Mount current working directory + - pixi # Install pixi package manager + - uv # Install uv Python package manager + - deps # Install common system dependencies + - dev-helpers # Add development tools (emacs, byobu) + - curl # Install curl + - ssh # SSH integration diff --git a/examples/basic.yaml b/examples/basic.yaml new file mode 100644 index 0000000..4ac9e47 --- /dev/null +++ b/examples/basic.yaml @@ -0,0 +1,18 @@ +# Basic rockerc.yaml Example +# +# This is the simplest configuration for rockerc. It specifies a base Docker +# image and a list of rocker extensions to enable. +# +# Equivalent rocker command: +# rocker --x11 --user --pull --git -- ubuntu:24.04 + +# The base Docker image to use +image: ubuntu:24.04 + +# List of rocker extensions to enable +# Extensions are features that rocker adds to the base image +args: + - x11 # Enable X11 forwarding for GUI applications + - user # Create a user inside the container matching your host user + - pull # Pull the latest version of the image before running + - git # Install and configure git with your host credentials diff --git a/examples/blacklist.yaml b/examples/blacklist.yaml new file mode 100644 index 0000000..0fd4965 --- /dev/null +++ b/examples/blacklist.yaml @@ -0,0 +1,37 @@ +# Extension Blacklist Example +# +# Use extension-blacklist to exclude unwanted extensions, particularly +# useful when you have global extensions in ~/.rockerc.yaml but want to +# disable specific ones for a project. +# +# This is useful for: +# - Disabling GPU support for CPU-only projects +# - Skipping X11 for headless containers +# - Removing conflicting or unnecessary extensions + +image: ubuntu:24.04 + +args: + - user + - pull + - git + - cwd + - pixi + +# Exclude specific extensions +# These will be filtered out even if present in global config or args above +extension-blacklist: + - nvidia # No GPU needed for this project + - x11 # Headless container - no GUI + - cuda # No CUDA support needed + +# How blacklist works: +# 1. Global config (~/.rockerc.yaml) might have: [user, pull, git, x11, nvidia] +# 2. Project config (this file) has args: [user, pull, git, cwd, pixi] +# 3. Merged args before blacklist: [user, pull, git, x11, nvidia, cwd, pixi] +# 4. After applying blacklist: [user, pull, git, cwd, pixi] +# +# Result: x11 and nvidia from global config are excluded + +# You can also have blacklist in global config to system-wide exclude extensions +# and override it per-project by adding them back to args diff --git a/examples/dockerfile.yaml b/examples/dockerfile.yaml new file mode 100644 index 0000000..1017aa1 --- /dev/null +++ b/examples/dockerfile.yaml @@ -0,0 +1,30 @@ +# Dockerfile-based rockerc.yaml Example +# +# Instead of using a pre-built image, you can specify a Dockerfile to build. +# rockerc will build the image and tag it automatically based on your +# project directory name. +# +# Note: When using dockerfile, the 'pull' extension is automatically removed +# since you're building locally. +# +# The dockerfile path is relative to the location of rockerc.yaml + +# Path to Dockerfile (relative to this rockerc.yaml) +dockerfile: ./Dockerfile + +# Extensions to apply to the built image +args: + - x11 # X11 forwarding + - user # User matching + - git # Git integration + - cwd # Mount working directory + - nvidia # GPU support (if your Dockerfile supports it) + +# Example Dockerfile content you might use: +# --- +# FROM ubuntu:24.04 +# RUN apt-get update && apt-get install -y \ +# python3 \ +# python3-pip \ +# build-essential +# --- diff --git a/examples/global-config.yaml b/examples/global-config.yaml new file mode 100644 index 0000000..cbe9de3 --- /dev/null +++ b/examples/global-config.yaml @@ -0,0 +1,30 @@ +# Global rockerc Configuration Example +# +# Save this as ~/.rockerc.yaml to set system-wide defaults +# that apply to all projects unless overridden. +# +# Project-specific rockerc.yaml files will: +# - Merge their 'args' list with these global args (duplicates removed) +# - Override other fields like 'image', 'name', 'volume', etc. +# - Can blacklist global extensions using 'extension-blacklist' +# +# This is useful for: +# - Setting up common development tools across all projects +# - Configuring user preferences (git, ssh, etc.) +# - Defining standard GPU or display settings + +# No image specified here - projects will provide their own +# Or you can set a default: +# image: ubuntu:24.04 + +# Global extensions applied to all containers +args: + - x11 # Always enable X11 for GUI apps + - user # Always match host user + - pull # Always pull latest images + - git # Git integration everywhere + - dev-helpers # Development tools in all containers + - cuda # GPU support (if you have NVIDIA GPU) + +# You can also set global volumes +# volume: ~/.config:/home/user/.config:ro diff --git a/examples/vscode.yaml b/examples/vscode.yaml new file mode 100644 index 0000000..00a0899 --- /dev/null +++ b/examples/vscode.yaml @@ -0,0 +1,37 @@ +# VS Code Dev Container Example +# +# This configuration is optimized for use with VS Code's Remote - Containers +# extension via the rockervsc command or 'rockerc --vsc'. +# +# Usage: +# rockerc --vsc # Launch container and attach VS Code +# rockervsc # Alias for the above command +# +# The container is always run in detached mode with a standardized workspace +# mount at /workspaces/. VS Code attaches to this running +# container for a seamless development experience. + +image: ubuntu:24.04 + +# Extensions for VS Code development +args: + - x11 # X11 support (for GUI debugging tools) + - user # User matching for correct file permissions + - pull # Ensure latest image + - git # Git integration + - pixi # Modern package management + - uv # Fast Python package installer + - deps # System dependencies + - dev-helpers # Development utilities + +# Optional: Pre-configure container name for consistency +# name: my-vscode-project + +# The --vsc flag automatically: +# 1. Ensures container runs detached with proper workspace mount +# 2. Launches VS Code attached to the container +# 3. Opens an interactive shell in the container +# 4. Reuses existing container if it's already running +# +# Use --force to recreate the container: +# rockerc --vsc --force From 5991773a55948d641e6d8a1969db630d1b9b322a Mon Sep 17 00:00:00 2001 From: Austin Gregg-Smith Date: Tue, 27 Jan 2026 19:10:42 +0000 Subject: [PATCH 3/7] Remove vscode example and add Intel GPU example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Removed examples/vscode.yaml (redundant with main documentation) - Added examples/intel-gpu.yaml demonstrating device mounting for Intel GPU - Updated documentation with 'devices' field reference - Added Intel GPU example to both README files Addresses feedback from issue #120 comment showing Intel GPU mounting pattern. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- README.md | 2 +- examples/README.md | 17 ++++++++++++++++- examples/intel-gpu.yaml | 31 +++++++++++++++++++++++++++++++ examples/vscode.yaml | 37 ------------------------------------- 4 files changed, 48 insertions(+), 39 deletions(-) create mode 100644 examples/intel-gpu.yaml delete mode 100644 examples/vscode.yaml diff --git a/README.md b/README.md index d3d87f3..77e8e6e 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,7 @@ For comprehensive examples and detailed documentation of all configuration optio - **[examples/advanced.yaml](examples/advanced.yaml)** - Feature-rich development setup - **[examples/dockerfile.yaml](examples/dockerfile.yaml)** - Using a custom Dockerfile - **[examples/global-config.yaml](examples/global-config.yaml)** - System-wide defaults -- **[examples/vscode.yaml](examples/vscode.yaml)** - VS Code optimized setup +- **[examples/intel-gpu.yaml](examples/intel-gpu.yaml)** - Mounting Intel GPU for hardware acceleration - **[examples/blacklist.yaml](examples/blacklist.yaml)** - Excluding extensions - **[examples/README.md](examples/README.md)** - Complete configuration reference diff --git a/examples/README.md b/examples/README.md index 2a83092..641a657 100644 --- a/examples/README.md +++ b/examples/README.md @@ -22,7 +22,7 @@ rockerc - **[advanced.yaml](advanced.yaml)** - Complex setup with multiple features - **[dockerfile.yaml](dockerfile.yaml)** - Using a custom Dockerfile instead of an image - **[global-config.yaml](global-config.yaml)** - System-wide defaults for `~/.rockerc.yaml` -- **[vscode.yaml](vscode.yaml)** - VS Code dev container optimized configuration +- **[intel-gpu.yaml](intel-gpu.yaml)** - Mounting Intel GPU for hardware acceleration - **[blacklist.yaml](blacklist.yaml)** - Excluding unwanted extensions ## Configuration Syntax @@ -104,6 +104,21 @@ volume: | Or pass via CLI: `rockerc --volume ~/.ssh:/root/.ssh:ro --volume /data:/workspace/data` +#### `devices` (string, optional) +Device paths to mount into the container for hardware access (e.g., GPU, cameras). + +```yaml +devices: /dev/dri # Intel GPU +devices: /dev/video0 # Webcam +devices: /dev/snd # Audio devices +``` + +Common use cases: +- `/dev/dri` - Intel integrated GPU for hardware acceleration +- `/dev/video*` - Webcams and video capture devices +- `/dev/snd` - Audio devices +- `/dev/ttyUSB*` - Serial devices + #### `extension-blacklist` (list, optional) List of extensions to exclude, even if they appear in global config or merged args. diff --git a/examples/intel-gpu.yaml b/examples/intel-gpu.yaml new file mode 100644 index 0000000..12fd0b5 --- /dev/null +++ b/examples/intel-gpu.yaml @@ -0,0 +1,31 @@ +# Intel GPU Example +# +# This example demonstrates how to mount Intel GPU devices for hardware +# acceleration in the container. This is useful for graphics rendering, +# video encoding/decoding, and compute workloads on Intel integrated GPUs. +# +# The key is using the 'devices' field to mount /dev/dri, which provides +# access to Intel GPU Direct Rendering Infrastructure. + +image: ubuntu:24.04 + +args: + - x11 # X11 forwarding for GUI applications + - user # Match host user + - pull # Pull latest image + - git # Git integration + - cwd # Mount working directory + +# Mount Intel GPU devices +# /dev/dri contains the renderD128 and card0 nodes for GPU access +devices: /dev/dri + +# This configuration enables: +# - OpenGL rendering on Intel integrated graphics +# - Hardware video encoding/decoding (VAAPI, QSV) +# - OpenCL compute on Intel GPUs +# +# Verify GPU access inside the container with: +# ls -la /dev/dri +# vainfo # For video acceleration info (install vainfo package) +# glxinfo | grep "OpenGL renderer" # For OpenGL info diff --git a/examples/vscode.yaml b/examples/vscode.yaml deleted file mode 100644 index 00a0899..0000000 --- a/examples/vscode.yaml +++ /dev/null @@ -1,37 +0,0 @@ -# VS Code Dev Container Example -# -# This configuration is optimized for use with VS Code's Remote - Containers -# extension via the rockervsc command or 'rockerc --vsc'. -# -# Usage: -# rockerc --vsc # Launch container and attach VS Code -# rockervsc # Alias for the above command -# -# The container is always run in detached mode with a standardized workspace -# mount at /workspaces/. VS Code attaches to this running -# container for a seamless development experience. - -image: ubuntu:24.04 - -# Extensions for VS Code development -args: - - x11 # X11 support (for GUI debugging tools) - - user # User matching for correct file permissions - - pull # Ensure latest image - - git # Git integration - - pixi # Modern package management - - uv # Fast Python package installer - - deps # System dependencies - - dev-helpers # Development utilities - -# Optional: Pre-configure container name for consistency -# name: my-vscode-project - -# The --vsc flag automatically: -# 1. Ensures container runs detached with proper workspace mount -# 2. Launches VS Code attached to the container -# 3. Opens an interactive shell in the container -# 4. Reuses existing container if it's already running -# -# Use --force to recreate the container: -# rockerc --vsc --force From 45b4d5f5896f47dfe58960ecb0008b3b421d6cc0 Mon Sep 17 00:00:00 2001 From: Austin Gregg-Smith Date: Tue, 27 Jan 2026 19:14:40 +0000 Subject: [PATCH 4/7] Update all examples with comprehensive core extensions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Updated basic.yaml with comprehensive core extension set: * pull, persist-image, x11, user, cwd * git, git-clone, ssh, ssh-client - Updated all other examples to include the core extensions: * advanced.yaml - Added core extensions with comments * intel-gpu.yaml - Added core extensions * dockerfile.yaml - Added core extensions (pull auto-removed note) * global-config.yaml - Updated to include core extensions * blacklist.yaml - Updated to demonstrate excluding core extensions - Updated examples/README.md: * Configuration hierarchy examples updated with core extensions * Common patterns updated to show core extensions baseline - Updated project rockerc.yaml with core extensions This establishes a consistent baseline of core functionality across all examples, making it clearer what extensions are recommended for most use cases. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- examples/README.md | 83 ++++++++++++++++++++++++++++--------- examples/advanced.yaml | 25 +++++++---- examples/basic.yaml | 23 ++++++---- examples/blacklist.yaml | 21 ++++++---- examples/dockerfile.yaml | 10 ++++- examples/global-config.yaml | 10 ++++- examples/intel-gpu.yaml | 13 ++++-- rockerc.yaml | 18 +++++--- 8 files changed, 148 insertions(+), 55 deletions(-) diff --git a/examples/README.md b/examples/README.md index 641a657..0a16c9c 100644 --- a/examples/README.md +++ b/examples/README.md @@ -203,9 +203,15 @@ rockerc supports two configuration locations that are merged: **~/.rockerc.yaml** (global): ```yaml args: + - pull + - persist-image - x11 - user + - cwd - git + - git-clone + - ssh + - ssh-client - dev-helpers ``` @@ -218,16 +224,22 @@ args: - pixi ``` -**Result**: Final args are `[x11, user, git, dev-helpers, nvidia, cuda, pixi]` +**Result**: Final args are `[pull, persist-image, x11, user, cwd, git, git-clone, ssh, ssh-client, dev-helpers, nvidia, cuda, pixi]` ### Using Blacklist **~/.rockerc.yaml** (global): ```yaml args: + - pull + - persist-image - x11 - user + - cwd - git + - git-clone + - ssh + - ssh-client - nvidia ``` @@ -237,11 +249,13 @@ image: ubuntu:24.04 args: - pixi extension-blacklist: - - nvidia # Don't need GPU for this project - - x11 # Headless container + - nvidia # Don't need GPU for this project + - x11 # Headless container + - ssh # No SSH server needed + - ssh-client # No SSH client needed ``` -**Result**: Final args are `[user, git, pixi]` +**Result**: Final args are `[pull, persist-image, user, cwd, git, git-clone, pixi]` ## CLI Integration @@ -285,24 +299,36 @@ rockerc --vsc --force ## Common Patterns -### Minimal Dev Container +### Minimal Dev Container (Basic) ```yaml image: ubuntu:24.04 args: - - user - pull - - git + - persist-image + - x11 + - user - cwd + - git + - git-clone + - ssh + - ssh-client ``` ### Python Development ```yaml image: python:3.12 args: - - user + # Core extensions - pull - - git + - persist-image + - x11 + - user - cwd + - git + - git-clone + - ssh + - ssh-client + # Python-specific - uv - pixi ``` @@ -311,24 +337,36 @@ args: ```yaml image: nvidia/cuda:12.0.0-base-ubuntu22.04 args: - - nvidia + # Core extensions + - pull + - persist-image - x11 - user - - pull - - git - cwd + - git + - git-clone + - ssh + - ssh-client + # GPU support + - nvidia ``` ### ROS Development ```yaml image: ros:jazzy args: - - nvidia + # Core extensions + - pull + - persist-image - x11 - user - - pull - - git - cwd + - git + - git-clone + - ssh + - ssh-client + # ROS-specific + - nvidia - dev-helpers ``` @@ -336,12 +374,19 @@ args: ```yaml image: ubuntu:24.04 args: - - nvidia - - cuda - - user + # Core extensions - pull - - git + - persist-image + - x11 + - user - cwd + - git + - git-clone + - ssh + - ssh-client + # AI/ML tools + - nvidia + - cuda - claude - pixi - uv diff --git a/examples/advanced.yaml b/examples/advanced.yaml index 529201d..5101ae1 100644 --- a/examples/advanced.yaml +++ b/examples/advanced.yaml @@ -1,12 +1,13 @@ # Advanced rockerc.yaml Example # -# This example demonstrates a more complex configuration with multiple -# extensions and custom options commonly used in development workflows. +# This example demonstrates a more complex configuration building on top +# of the basic core extensions with additional features commonly used in +# development workflows. # # Equivalent rocker command: -# rocker --nvidia --x11 --user --pull --git --cwd --pixi --uv \ -# --deps --dev-helpers --volume ~/.ssh:/root/.ssh:ro \ -# --name my-dev-container -- ubuntu:24.04 +# rocker --pull --persist-image --x11 --user --cwd --git --git-clone \ +# --ssh --ssh-client --nvidia --pixi --uv --deps --dev-helpers --curl \ +# --volume ~/.ssh:/root/.ssh:ro --name my-dev-container -- ubuntu:24.04 # Base Docker image image: ubuntu:24.04 @@ -21,15 +22,21 @@ volume: ~/.ssh:/root/.ssh:ro # Comprehensive list of development extensions args: - - nvidia # Enable NVIDIA GPU support + # Core extensions (from basic.yaml) + - pull # Pull latest image version + - persist-image # Keep the image after container stops - x11 # X11 forwarding for GUI applications - user # Match host user inside container - - pull # Pull latest image version - - git # Git integration with host config - cwd # Mount current working directory + - git # Git integration with host config + - git-clone # Clone repositories with proper credentials + - ssh # SSH server integration + - ssh-client # SSH client with host key forwarding + + # Additional advanced features + - nvidia # Enable NVIDIA GPU support - pixi # Install pixi package manager - uv # Install uv Python package manager - deps # Install common system dependencies - dev-helpers # Add development tools (emacs, byobu) - curl # Install curl - - ssh # SSH integration diff --git a/examples/basic.yaml b/examples/basic.yaml index 4ac9e47..55c282c 100644 --- a/examples/basic.yaml +++ b/examples/basic.yaml @@ -1,18 +1,25 @@ # Basic rockerc.yaml Example # -# This is the simplest configuration for rockerc. It specifies a base Docker -# image and a list of rocker extensions to enable. +# This is a comprehensive baseline configuration with core extensions +# that are useful for most development workflows. # # Equivalent rocker command: -# rocker --x11 --user --pull --git -- ubuntu:24.04 +# rocker --pull --persist-image --x11 --user --cwd --git \ +# --git-clone --ssh --ssh-client -- ubuntu:24.04 # The base Docker image to use image: ubuntu:24.04 # List of rocker extensions to enable -# Extensions are features that rocker adds to the base image +# These are considered "core" extensions for most development workflows args: - - x11 # Enable X11 forwarding for GUI applications - - user # Create a user inside the container matching your host user - - pull # Pull the latest version of the image before running - - git # Install and configure git with your host credentials + # Core extensions + - pull # Pull the latest version of the image before running + - persist-image # Keep the image after container stops + - x11 # Enable X11 forwarding for GUI applications + - user # Create a user inside the container matching your host user + - cwd # Mount current working directory into the container + - git # Install and configure git with your host credentials + - git-clone # Clone git repositories with proper credentials + - ssh # SSH server integration + - ssh-client # SSH client with host key forwarding diff --git a/examples/blacklist.yaml b/examples/blacklist.yaml index 0fd4965..a8b3f6b 100644 --- a/examples/blacklist.yaml +++ b/examples/blacklist.yaml @@ -12,10 +12,15 @@ image: ubuntu:24.04 args: - - user + # Core extensions (excluding x11 and ssh for headless use) - pull - - git + - persist-image + - user - cwd + - git + - git-clone + + # Project-specific extensions - pixi # Exclude specific extensions @@ -24,14 +29,16 @@ extension-blacklist: - nvidia # No GPU needed for this project - x11 # Headless container - no GUI - cuda # No CUDA support needed + - ssh # No SSH server needed + - ssh-client # No SSH client needed # How blacklist works: -# 1. Global config (~/.rockerc.yaml) might have: [user, pull, git, x11, nvidia] -# 2. Project config (this file) has args: [user, pull, git, cwd, pixi] -# 3. Merged args before blacklist: [user, pull, git, x11, nvidia, cwd, pixi] -# 4. After applying blacklist: [user, pull, git, cwd, pixi] +# 1. Global config (~/.rockerc.yaml) might have: [pull, persist-image, x11, user, cwd, git, git-clone, ssh, ssh-client, cuda] +# 2. Project config (this file) has args: [pull, persist-image, user, cwd, git, git-clone, pixi] +# 3. Merged args before blacklist: [pull, persist-image, x11, user, cwd, git, git-clone, ssh, ssh-client, cuda, pixi] +# 4. After applying blacklist: [pull, persist-image, user, cwd, git, git-clone, pixi] # -# Result: x11 and nvidia from global config are excluded +# Result: x11, ssh, ssh-client, cuda from global config are excluded # You can also have blacklist in global config to system-wide exclude extensions # and override it per-project by adding them back to args diff --git a/examples/dockerfile.yaml b/examples/dockerfile.yaml index 1017aa1..953557a 100644 --- a/examples/dockerfile.yaml +++ b/examples/dockerfile.yaml @@ -14,10 +14,18 @@ dockerfile: ./Dockerfile # Extensions to apply to the built image args: + # Core extensions (pull will be auto-removed when using dockerfile) + - pull # Will be automatically removed for local builds + - persist-image # Keep the image after container stops - x11 # X11 forwarding - user # User matching - - git # Git integration - cwd # Mount working directory + - git # Git integration + - git-clone # Clone repositories with proper credentials + - ssh # SSH server integration + - ssh-client # SSH client with host key forwarding + + # Additional extensions - nvidia # GPU support (if your Dockerfile supports it) # Example Dockerfile content you might use: diff --git a/examples/global-config.yaml b/examples/global-config.yaml index cbe9de3..a442e4f 100644 --- a/examples/global-config.yaml +++ b/examples/global-config.yaml @@ -19,10 +19,18 @@ # Global extensions applied to all containers args: + # Core extensions - applied to all projects + - pull # Always pull latest images + - persist-image # Keep images after container stops - x11 # Always enable X11 for GUI apps - user # Always match host user - - pull # Always pull latest images + - cwd # Mount working directory - git # Git integration everywhere + - git-clone # Clone repositories with proper credentials + - ssh # SSH server integration + - ssh-client # SSH client with host key forwarding + + # Additional global extensions (customize as needed) - dev-helpers # Development tools in all containers - cuda # GPU support (if you have NVIDIA GPU) diff --git a/examples/intel-gpu.yaml b/examples/intel-gpu.yaml index 12fd0b5..6b5a718 100644 --- a/examples/intel-gpu.yaml +++ b/examples/intel-gpu.yaml @@ -10,11 +10,16 @@ image: ubuntu:24.04 args: + # Core extensions + - pull # Pull latest image version + - persist-image # Keep the image after container stops - x11 # X11 forwarding for GUI applications - - user # Match host user - - pull # Pull latest image - - git # Git integration - - cwd # Mount working directory + - user # Match host user inside container + - cwd # Mount current working directory + - git # Git integration with host config + - git-clone # Clone repositories with proper credentials + - ssh # SSH server integration + - ssh-client # SSH client with host key forwarding # Mount Intel GPU devices # /dev/dri contains the renderD128 and card0 nodes for GPU access diff --git a/rockerc.yaml b/rockerc.yaml index 9cc924b..86b2b94 100644 --- a/rockerc.yaml +++ b/rockerc.yaml @@ -7,13 +7,19 @@ image: ubuntu:24.04 args: - - jquery - - x11 - - user - - pull - - deps - - git + # Core extensions + - pull + - persist-image + - x11 + - user - cwd + - git + - git-clone + - ssh + - ssh-client + + # Project-specific extensions + - deps - pixi - uv - jquery From cf5e4fcbc3a526ee6ba162b115533a90fedabd7e Mon Sep 17 00:00:00 2001 From: Austin Gregg-Smith Date: Tue, 27 Jan 2026 19:19:26 +0000 Subject: [PATCH 5/7] Fix advanced example to remove redundant SSH volume mount MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Removed `~/.ssh` volume mount from advanced.yaml since SSH is already handled by ssh/ssh-client extensions - Replaced with data directory mount example: `/data:/workspace/data` - Added `shm-size: 2g` to demonstrate shared memory configuration (useful for PyTorch, Chrome, multiprocessing applications) - Updated examples/README.md: * Removed SSH volume mount examples from volume field documentation * Added note that SSH is handled by extensions * Updated examples to show data directories and config files * Added `shm-size` field documentation with use cases This eliminates confusion about redundant SSH mounting and showcases more appropriate volume mount use cases. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- examples/README.md | 23 +++++++++++++++++++---- examples/advanced.yaml | 12 +++++++++--- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/examples/README.md b/examples/README.md index 0a16c9c..e25d687 100644 --- a/examples/README.md +++ b/examples/README.md @@ -91,18 +91,20 @@ image-name: my-custom-image Additional volume mounts in Docker format: `HOST_PATH:CONTAINER_PATH[:OPTIONS]` ```yaml -volume: ~/.ssh:/root/.ssh:ro -volume: /data:/workspace/data +volume: /data:/workspace/data # Mount data directory +volume: ~/.vimrc:/home/user/.vimrc:ro # Mount config files (read-only) ``` For multiple volumes, you can use YAML multi-line: ```yaml volume: | - ~/.ssh:/root/.ssh:ro /data:/workspace/data + ~/.vimrc:/home/user/.vimrc:ro ``` -Or pass via CLI: `rockerc --volume ~/.ssh:/root/.ssh:ro --volume /data:/workspace/data` +Or pass via CLI: `rockerc --volume /data:/workspace/data --volume ~/.vimrc:/home/user/.vimrc:ro` + +**Note:** SSH keys are automatically handled by the `ssh` and `ssh-client` extensions, so you don't need to manually mount `~/.ssh`. #### `devices` (string, optional) Device paths to mount into the container for hardware access (e.g., GPU, cameras). @@ -119,6 +121,19 @@ Common use cases: - `/dev/snd` - Audio devices - `/dev/ttyUSB*` - Serial devices +#### `shm-size` (string, optional) +Size of `/dev/shm` (shared memory) in the container. Useful for applications that use shared memory extensively. + +```yaml +shm-size: 2g # 2 gigabytes +shm-size: 512m # 512 megabytes +``` + +Common use cases: +- PyTorch DataLoader with multiple workers +- Chrome/Firefox in containers +- Applications using multiprocessing with shared memory + #### `extension-blacklist` (list, optional) List of extensions to exclude, even if they appear in global config or merged args. diff --git a/examples/advanced.yaml b/examples/advanced.yaml index 5101ae1..9069277 100644 --- a/examples/advanced.yaml +++ b/examples/advanced.yaml @@ -7,7 +7,8 @@ # Equivalent rocker command: # rocker --pull --persist-image --x11 --user --cwd --git --git-clone \ # --ssh --ssh-client --nvidia --pixi --uv --deps --dev-helpers --curl \ -# --volume ~/.ssh:/root/.ssh:ro --name my-dev-container -- ubuntu:24.04 +# --volume /data:/workspace/data --shm-size 2g \ +# --name my-dev-container -- ubuntu:24.04 # Base Docker image image: ubuntu:24.04 @@ -16,9 +17,14 @@ image: ubuntu:24.04 # If not specified, rockerc generates a name based on the project directory name: my-dev-container -# Custom volume mounts (optional) +# Custom volume mount (optional) +# Useful for mounting external data directories or shared storage # Format: HOST_PATH:CONTAINER_PATH[:OPTIONS] -volume: ~/.ssh:/root/.ssh:ro +volume: /data:/workspace/data + +# Increase shared memory size for applications that need it +# (e.g., PyTorch DataLoader with multiple workers, Chrome/Firefox) +shm-size: 2g # Comprehensive list of development extensions args: From 611d783d7a62600a458f2a6553fdec588db77dd7 Mon Sep 17 00:00:00 2001 From: Austin Gregg-Smith Date: Tue, 27 Jan 2026 19:21:19 +0000 Subject: [PATCH 6/7] Fix extension comments to match actual implementations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Corrected descriptions for git, git-clone, ssh, and ssh-client extensions based on their actual behavior from rocker and deps_rocker: - git: Use the global Git settings from the host (not "install git") - git-clone: Install git, git-lfs, and ca-certificates for cloning - ssh: Forward SSH agent into the container (not "SSH server") - ssh-client: Install openssh-client and mount ~/.ssh directory Updated in all files: - examples/basic.yaml - examples/advanced.yaml - examples/intel-gpu.yaml - examples/dockerfile.yaml - examples/global-config.yaml - examples/README.md (Available Extensions section) - rockerc.yaml (project config) These descriptions now accurately reflect what the extensions do rather than what users might assume they do. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- examples/README.md | 6 ++++-- examples/advanced.yaml | 8 ++++---- examples/basic.yaml | 8 ++++---- examples/dockerfile.yaml | 8 ++++---- examples/global-config.yaml | 8 ++++---- examples/intel-gpu.yaml | 8 ++++---- rockerc.yaml | 18 +++++++++--------- 7 files changed, 33 insertions(+), 31 deletions(-) diff --git a/examples/README.md b/examples/README.md index e25d687..b768181 100644 --- a/examples/README.md +++ b/examples/README.md @@ -157,8 +157,10 @@ Common rocker extensions you can use in `args`: - `privileged` - Run container in privileged mode (use with caution) ### Development Tools -- `git` - Install and configure git with host credentials -- `ssh` - SSH integration +- `git` - Use the global Git settings from the host (/etc/gitconfig and ~/.gitconfig) +- `git-clone` - Install git, git-lfs, and ca-certificates for repository cloning +- `ssh` - Forward SSH agent into the container +- `ssh-client` - Install openssh-client and mount ~/.ssh directory - `dev-helpers` - Development tools (emacs, byobu) - `deps` - Common system dependencies - `deps-devtools` - Developer productivity tools (ripgrep, fd-find, fzf) diff --git a/examples/advanced.yaml b/examples/advanced.yaml index 9069277..54c3268 100644 --- a/examples/advanced.yaml +++ b/examples/advanced.yaml @@ -34,10 +34,10 @@ args: - x11 # X11 forwarding for GUI applications - user # Match host user inside container - cwd # Mount current working directory - - git # Git integration with host config - - git-clone # Clone repositories with proper credentials - - ssh # SSH server integration - - ssh-client # SSH client with host key forwarding + - git # Use the global Git settings from the host + - git-clone # Install git, git-lfs, and ca-certificates for cloning + - ssh # Forward SSH agent into the container + - ssh-client # Install openssh-client and mount ~/.ssh directory # Additional advanced features - nvidia # Enable NVIDIA GPU support diff --git a/examples/basic.yaml b/examples/basic.yaml index 55c282c..474df39 100644 --- a/examples/basic.yaml +++ b/examples/basic.yaml @@ -19,7 +19,7 @@ args: - x11 # Enable X11 forwarding for GUI applications - user # Create a user inside the container matching your host user - cwd # Mount current working directory into the container - - git # Install and configure git with your host credentials - - git-clone # Clone git repositories with proper credentials - - ssh # SSH server integration - - ssh-client # SSH client with host key forwarding + - git # Use the global Git settings from the host + - git-clone # Install git, git-lfs, and ca-certificates for cloning + - ssh # Forward SSH agent into the container + - ssh-client # Install openssh-client and mount ~/.ssh directory diff --git a/examples/dockerfile.yaml b/examples/dockerfile.yaml index 953557a..a074da0 100644 --- a/examples/dockerfile.yaml +++ b/examples/dockerfile.yaml @@ -20,10 +20,10 @@ args: - x11 # X11 forwarding - user # User matching - cwd # Mount working directory - - git # Git integration - - git-clone # Clone repositories with proper credentials - - ssh # SSH server integration - - ssh-client # SSH client with host key forwarding + - git # Use the global Git settings from the host + - git-clone # Install git, git-lfs, and ca-certificates for cloning + - ssh # Forward SSH agent into the container + - ssh-client # Install openssh-client and mount ~/.ssh directory # Additional extensions - nvidia # GPU support (if your Dockerfile supports it) diff --git a/examples/global-config.yaml b/examples/global-config.yaml index a442e4f..81c21e8 100644 --- a/examples/global-config.yaml +++ b/examples/global-config.yaml @@ -25,10 +25,10 @@ args: - x11 # Always enable X11 for GUI apps - user # Always match host user - cwd # Mount working directory - - git # Git integration everywhere - - git-clone # Clone repositories with proper credentials - - ssh # SSH server integration - - ssh-client # SSH client with host key forwarding + - git # Use the global Git settings from the host + - git-clone # Install git, git-lfs, and ca-certificates for cloning + - ssh # Forward SSH agent into the container + - ssh-client # Install openssh-client and mount ~/.ssh directory # Additional global extensions (customize as needed) - dev-helpers # Development tools in all containers diff --git a/examples/intel-gpu.yaml b/examples/intel-gpu.yaml index 6b5a718..820fc7f 100644 --- a/examples/intel-gpu.yaml +++ b/examples/intel-gpu.yaml @@ -16,10 +16,10 @@ args: - x11 # X11 forwarding for GUI applications - user # Match host user inside container - cwd # Mount current working directory - - git # Git integration with host config - - git-clone # Clone repositories with proper credentials - - ssh # SSH server integration - - ssh-client # SSH client with host key forwarding + - git # Use the global Git settings from the host + - git-clone # Install git, git-lfs, and ca-certificates for cloning + - ssh # Forward SSH agent into the container + - ssh-client # Install openssh-client and mount ~/.ssh directory # Mount Intel GPU devices # /dev/dri contains the renderD128 and card0 nodes for GPU access diff --git a/rockerc.yaml b/rockerc.yaml index 86b2b94..777a37b 100644 --- a/rockerc.yaml +++ b/rockerc.yaml @@ -8,15 +8,15 @@ image: ubuntu:24.04 args: # Core extensions - - pull - - persist-image - - x11 - - user - - cwd - - git - - git-clone - - ssh - - ssh-client + - pull # Pull latest image version + - persist-image # Keep the image after container stops + - x11 # X11 forwarding for GUI applications + - user # Match host user inside container + - cwd # Mount current working directory + - git # Use the global Git settings from the host + - git-clone # Install git, git-lfs, and ca-certificates for cloning + - ssh # Forward SSH agent into the container + - ssh-client # Install openssh-client and mount ~/.ssh directory # Project-specific extensions - deps From 26cf0749275030bc396aa8a60795d0dff7d92905 Mon Sep 17 00:00:00 2001 From: Austin Gregg-Smith Date: Tue, 27 Jan 2026 19:22:19 +0000 Subject: [PATCH 7/7] Remove examples/README.md, keep only example YAML files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Removed examples/README.md to reduce documentation maintenance burden - Updated main README.md to remove reference to examples/README.md - Simplified examples section description - Example YAML files are self-documenting with inline comments This streamlines the documentation by keeping configuration examples in the YAML files themselves where they're most useful. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- README.md | 14 +- examples/README.md | 497 --------------------------------------------- 2 files changed, 4 insertions(+), 507 deletions(-) delete mode 100644 examples/README.md diff --git a/README.md b/README.md index 77e8e6e..9a26a81 100644 --- a/README.md +++ b/README.md @@ -153,19 +153,13 @@ will look for the dockerfile relative to the rockerc.yaml file ## Configuration Examples -For comprehensive examples and detailed documentation of all configuration options, see the [examples/](examples/) directory: +See the [examples/](examples/) directory for comprehensive configuration examples: -- **[examples/basic.yaml](examples/basic.yaml)** - Simple starter configuration +- **[examples/basic.yaml](examples/basic.yaml)** - Simple starter configuration with core extensions - **[examples/advanced.yaml](examples/advanced.yaml)** - Feature-rich development setup - **[examples/dockerfile.yaml](examples/dockerfile.yaml)** - Using a custom Dockerfile - **[examples/global-config.yaml](examples/global-config.yaml)** - System-wide defaults - **[examples/intel-gpu.yaml](examples/intel-gpu.yaml)** - Mounting Intel GPU for hardware acceleration - **[examples/blacklist.yaml](examples/blacklist.yaml)** - Excluding extensions -- **[examples/README.md](examples/README.md)** - Complete configuration reference - -These examples demonstrate: -- Available rocker extensions and how to use them -- Configuration field syntax and options -- How global and project configs merge -- CLI integration and override behavior -- Common development patterns and use cases + +Each example includes detailed inline comments explaining the configuration options and their purposes. diff --git a/examples/README.md b/examples/README.md deleted file mode 100644 index b768181..0000000 --- a/examples/README.md +++ /dev/null @@ -1,497 +0,0 @@ -# rockerc.yaml Configuration Guide - -This directory contains example `rockerc.yaml` configuration files that demonstrate how to use rockerc with various setups and features. - -## Quick Start - -1. Copy one of the example files to your project directory as `rockerc.yaml` -2. Customize the `image` and `args` to match your needs -3. Run `rockerc` in that directory - -```bash -# Copy basic example -cp examples/basic.yaml ./rockerc.yaml - -# Run rockerc -rockerc -``` - -## Available Examples - -- **[basic.yaml](basic.yaml)** - Simple configuration with common extensions -- **[advanced.yaml](advanced.yaml)** - Complex setup with multiple features -- **[dockerfile.yaml](dockerfile.yaml)** - Using a custom Dockerfile instead of an image -- **[global-config.yaml](global-config.yaml)** - System-wide defaults for `~/.rockerc.yaml` -- **[intel-gpu.yaml](intel-gpu.yaml)** - Mounting Intel GPU for hardware acceleration -- **[blacklist.yaml](blacklist.yaml)** - Excluding unwanted extensions - -## Configuration Syntax - -### Basic Structure - -```yaml -# Required: Specify either 'image' or 'dockerfile' -image: ubuntu:24.04 - -# Required: List of rocker extensions to enable -args: - - x11 - - user - - git -``` - -### Configuration Fields - -#### `image` (string, required unless using `dockerfile`) -The base Docker image to use. - -```yaml -image: ubuntu:24.04 -image: nvidia/cuda:12.0.0-base-ubuntu22.04 -image: ros:jazzy -``` - -#### `dockerfile` (string, alternative to `image`) -Path to a Dockerfile to build instead of using a pre-built image. Path is relative to the location of `rockerc.yaml`. - -```yaml -dockerfile: ./Dockerfile -dockerfile: ./docker/Dockerfile.dev -``` - -**Note:** When using `dockerfile`, the `pull` extension is automatically removed since you're building locally. - -#### `args` (list, required) -List of rocker extensions to enable. Each extension adds functionality to your container. - -```yaml -args: - - x11 # X11 forwarding for GUI apps - - user # Match host user/group IDs - - nvidia # NVIDIA GPU support -``` - -See [Available Extensions](#available-extensions) below for a complete list. - -#### `name` (string, optional) -Custom container name. If not specified, rockerc generates a name based on the project directory. - -```yaml -name: my-dev-container -``` - -#### `image-name` (string, optional) -Custom name for the built image (when using rocker). - -```yaml -image-name: my-custom-image -``` - -#### `volume` (string, optional) -Additional volume mounts in Docker format: `HOST_PATH:CONTAINER_PATH[:OPTIONS]` - -```yaml -volume: /data:/workspace/data # Mount data directory -volume: ~/.vimrc:/home/user/.vimrc:ro # Mount config files (read-only) -``` - -For multiple volumes, you can use YAML multi-line: -```yaml -volume: | - /data:/workspace/data - ~/.vimrc:/home/user/.vimrc:ro -``` - -Or pass via CLI: `rockerc --volume /data:/workspace/data --volume ~/.vimrc:/home/user/.vimrc:ro` - -**Note:** SSH keys are automatically handled by the `ssh` and `ssh-client` extensions, so you don't need to manually mount `~/.ssh`. - -#### `devices` (string, optional) -Device paths to mount into the container for hardware access (e.g., GPU, cameras). - -```yaml -devices: /dev/dri # Intel GPU -devices: /dev/video0 # Webcam -devices: /dev/snd # Audio devices -``` - -Common use cases: -- `/dev/dri` - Intel integrated GPU for hardware acceleration -- `/dev/video*` - Webcams and video capture devices -- `/dev/snd` - Audio devices -- `/dev/ttyUSB*` - Serial devices - -#### `shm-size` (string, optional) -Size of `/dev/shm` (shared memory) in the container. Useful for applications that use shared memory extensively. - -```yaml -shm-size: 2g # 2 gigabytes -shm-size: 512m # 512 megabytes -``` - -Common use cases: -- PyTorch DataLoader with multiple workers -- Chrome/Firefox in containers -- Applications using multiprocessing with shared memory - -#### `extension-blacklist` (list, optional) -List of extensions to exclude, even if they appear in global config or merged args. - -```yaml -extension-blacklist: - - nvidia # Disable GPU support - - x11 # Disable X11 for headless container -``` - -## Available Extensions - -Common rocker extensions you can use in `args`: - -### Display & GUI -- `x11` - X11 forwarding for GUI applications -- `nvidia` - NVIDIA GPU support with display capabilities - -### User & Permissions -- `user` - Create a user matching your host user/group ID -- `user-preserve-home` - Preserve home directory structure -- `privileged` - Run container in privileged mode (use with caution) - -### Development Tools -- `git` - Use the global Git settings from the host (/etc/gitconfig and ~/.gitconfig) -- `git-clone` - Install git, git-lfs, and ca-certificates for repository cloning -- `ssh` - Forward SSH agent into the container -- `ssh-client` - Install openssh-client and mount ~/.ssh directory -- `dev-helpers` - Development tools (emacs, byobu) -- `deps` - Common system dependencies -- `deps-devtools` - Developer productivity tools (ripgrep, fd-find, fzf) -- `curl` - Install curl -- `nvim` - Install Neovim - -### Package Managers -- `pixi` - Install pixi package manager -- `uv` - Install uv Python package manager -- `conda` - Install Miniconda -- `npm` - Install Node.js and npm -- `cargo` - Install Rust and Cargo -- `homebrew` - Install Homebrew - -### Container Features -- `pull` - Pull latest image before running -- `detach` - Run container in detached mode -- `cwd` - Mount current working directory at ~/project_name -- `auto` - Automatically discover and mount workspace - -### GPU & Compute -- `nvidia` - NVIDIA GPU support -- `cuda` - Install CUDA and nvidia-cuda-dev - -### AI Development Tools -- `claude` - Install Claude Code CLI -- `codex` - Install OpenAI Codex CLI -- `gemini` - Install Gemini CLI - -### Other Extensions -- `ccache` - Install ccache and share cache with host -- `locales` - Configure locales -- `tzdata` - Configure timezone -- `pulse` - PulseAudio support -- `home` - Mount home directory - -For a complete and up-to-date list, run: -```bash -rocker --help -``` - -## Configuration Hierarchy - -rockerc supports two configuration locations that are merged: - -1. **Global config**: `~/.rockerc.yaml` - System-wide defaults -2. **Project config**: `./rockerc.yaml` - Project-specific settings - -### Merge Behavior - -- **`args` field**: Lists are merged and deduplicated (global + project) -- **Other fields**: Project config overrides global config -- **`extension-blacklist`**: Lists are merged to exclude extensions from either source - -### Example: Global + Project Config - -**~/.rockerc.yaml** (global): -```yaml -args: - - pull - - persist-image - - x11 - - user - - cwd - - git - - git-clone - - ssh - - ssh-client - - dev-helpers -``` - -**./rockerc.yaml** (project): -```yaml -image: ubuntu:24.04 -args: - - nvidia - - cuda - - pixi -``` - -**Result**: Final args are `[pull, persist-image, x11, user, cwd, git, git-clone, ssh, ssh-client, dev-helpers, nvidia, cuda, pixi]` - -### Using Blacklist - -**~/.rockerc.yaml** (global): -```yaml -args: - - pull - - persist-image - - x11 - - user - - cwd - - git - - git-clone - - ssh - - ssh-client - - nvidia -``` - -**./rockerc.yaml** (project): -```yaml -image: ubuntu:24.04 -args: - - pixi -extension-blacklist: - - nvidia # Don't need GPU for this project - - x11 # Headless container - - ssh # No SSH server needed - - ssh-client # No SSH client needed -``` - -**Result**: Final args are `[pull, persist-image, user, cwd, git, git-clone, pixi]` - -## CLI Integration - -rockerc accepts additional arguments that merge with or override the YAML config: - -### Adding Extensions via CLI -```bash -# Add nvidia extension to config args -rockerc nvidia - -# Add multiple extensions -rockerc nvidia cuda -``` - -### Overriding Image -```bash -# Override the image specified in rockerc.yaml -rockerc -- ubuntu:22.04 -``` - -### Passing Additional Options -```bash -# Pass arbitrary rocker/docker options -rockerc --env MY_VAR=value --port 8080:8080 - -# With image override -rockerc --env MY_VAR=value -- ubuntu:24.04 -``` - -### VS Code Integration -```bash -# Launch container and attach VS Code -rockerc --vsc - -# Or use the alias -rockervsc - -# Force recreate container -rockerc --vsc --force -``` - -## Common Patterns - -### Minimal Dev Container (Basic) -```yaml -image: ubuntu:24.04 -args: - - pull - - persist-image - - x11 - - user - - cwd - - git - - git-clone - - ssh - - ssh-client -``` - -### Python Development -```yaml -image: python:3.12 -args: - # Core extensions - - pull - - persist-image - - x11 - - user - - cwd - - git - - git-clone - - ssh - - ssh-client - # Python-specific - - uv - - pixi -``` - -### NVIDIA GPU Development -```yaml -image: nvidia/cuda:12.0.0-base-ubuntu22.04 -args: - # Core extensions - - pull - - persist-image - - x11 - - user - - cwd - - git - - git-clone - - ssh - - ssh-client - # GPU support - - nvidia -``` - -### ROS Development -```yaml -image: ros:jazzy -args: - # Core extensions - - pull - - persist-image - - x11 - - user - - cwd - - git - - git-clone - - ssh - - ssh-client - # ROS-specific - - nvidia - - dev-helpers -``` - -### AI/ML Development with Claude Code -```yaml -image: ubuntu:24.04 -args: - # Core extensions - - pull - - persist-image - - x11 - - user - - cwd - - git - - git-clone - - ssh - - ssh-client - # AI/ML tools - - nvidia - - cuda - - claude - - pixi - - uv -``` - -## Quirks and Limitations - -### 1. Extension Order -Most extensions are order-independent, but some have requirements: -- `cache-perms` must run before extensions that mount subdirectories under `.cache` (like `claude`) - -### 2. Dockerfile + Pull -When using `dockerfile`, the `pull` extension is automatically removed since you're building locally. - -### 3. Detached Mode -rockerc always runs containers in detached mode and attaches via `docker exec` for better reliability. - -### 4. Container Naming -If you don't specify a `name`, rockerc generates one based on your project directory. This ensures consistent container names across runs. - -### 5. Workspace Mounting -With `--vsc` or `rockervsc`, the workspace is always mounted at `/workspaces/` to match VS Code's expectations. - -### 6. Environment Variables in Config -You can use environment variables in the YAML: -```yaml -name: '"$CONTAINER_NAME"' -volume: '"${PWD}":/workspaces/"${CONTAINER_NAME}":Z' -``` - -### 7. YAML Indentation -Ensure consistent indentation for list items: - -❌ **Incorrect**: -```yaml -args: - - x11 - - user # Inconsistent indentation -``` - -✅ **Correct**: -```yaml -args: - - x11 - - user -``` - -## Troubleshooting - -### "No rockerc.yaml found" -Make sure you have a `rockerc.yaml` file in the current directory or set up a global `~/.rockerc.yaml`. - -### "No 'args' key found" -The `args` field is required. Add at least one extension: -```yaml -args: - - user -``` - -### Extensions Not Working -- Check that the extension name is spelled correctly -- Run `rocker --help` to see all available extensions -- Some extensions require specific base images (e.g., `nvidia` needs NVIDIA drivers) - -### YAML Parsing Errors -- Check for consistent indentation (use spaces, not tabs) -- Ensure list items start with `- ` -- Validate your YAML syntax with a YAML validator - -### Container Already Exists -If you want to recreate a container: -```bash -rockerc --force -``` - -Or manually remove it: -```bash -docker rm -f -rockerc -``` - -## Additional Resources - -- [rockerc README](../README.md) - Main project documentation -- [rocker GitHub](https://github.com/osrf/rocker) - Underlying rocker tool -- [rocker extensions](https://github.com/osrf/rocker) - Extension documentation -- [Issue #120](https://github.com/blooop/rockerc/issues/120) - Original feature request - -## Contributing - -Found an issue or want to add more examples? Please [open an issue](https://github.com/blooop/rockerc/issues) or submit a pull request!