Containerized Ray environments with a clean CLI + SDK
Pure-Python orchestration for running Ray head in Docker and launching environments as containerized Ray actors.
rf provides two interfaces:
rf new dummy # scaffold a new env directory (Dockerfile + env.py)
rf build dummy # docker build -t local/dummy:latest ./dummy
rf invoke dummy inc # runs env.inc() via Ray (starts Ray head if needed)import rf
import ray
# Start Ray cluster
cluster = af.Cluster()
cluster.up()
# Connect to Ray
ray.init("ray://localhost:10001")
# Create containerized actor
env = rf.create("./dummy")
result = ray.get(env.inc.remote())uv pip install -e .fr new myenvThis scaffolds:
myenv/
├── Dockerfile # Ray base + your dependencies
└── env.py # Your environment class
rf build myenvrf invoke myenv incrf/
├── __init__.py # SDK exports: Cluster, create
├── cli.py # CLI commands: new, build, invoke
├── cluster.py # Ray head management
├── env.py # Containerized actor creation
└── templates/ # Boilerplate for new environments
├── Dockerfile
└── env.py
- Hash-based versioning - Only rebuilds when environment files change
- Docker socket mounting - Ray head can build/launch worker containers
- Embedded source fallback - Environments work even without explicit image installation
- Automatic Ray management - CLI starts Ray head automatically when needed
- Clean API surface - Both CLI and SDK share the same primitives
See dummy/ for a complete example environment and main.py for SDK usage.