Skip to main content
Read a file from a container image without spawning a VM.

Overview

read_file provides instant file content access without the overhead of starting a container. Use it to inspect configuration files, review scripts, or check expected content before running commands.

Parameters

Returns

Cost

Free - No VM spawned. Reads directly from image filesystem.

Text Detection

Files are automatically detected as text based on extension. Common text extensions include:
  • Source code: .py, .js, .ts, .go, .rs, .java, .c, .h, .cpp
  • Config: .json, .yaml, .yml, .toml, .ini, .cfg, .conf
  • Scripts: .sh, .bash, .zsh
  • Documentation: .md, .rst, .txt
  • Web: .html, .css, .xml
Binary files are decoded with replacement characters for non-UTF8 bytes.

Examples

Read Configuration File

Response:

Check Python Package Version

Review Script Before Execution

Best Practices

  • Prefer over run("cat") - read_file is instant and free
  • Review before executing - Check scripts for safety before running
  • Inspect configurations - Understand image setup without running commands
  • Verify expected content - Check files contain what you expect

See Also

  • list_files - List directory contents without VM
  • download - Download file to local filesystem
  • Resources - contree://image/{image}/read/{path} resource alternative