Skip to main content
CooperBench uses Docker-based environments to provide isolated, reproducible task execution. Each task runs in a containerized environment with the repository code and test infrastructure.

Environment structure

Each task has a corresponding Docker image that includes:
  • Base repository code (before features are implemented)
  • Python/Node.js/other runtime dependencies
  • Test runner script (/usr/local/bin/runner.sh)
  • Git repository setup

Image naming convention

Images follow the pattern:
Examples:
  • cooperbench/llama_index_task:task1
  • cooperbench/django_task:task5
  • cooperbench/flask_task:task3

Getting image names

Working with environments

Create a sandbox

Execute commands

Apply patches

Run tests

Test runner script

Each environment includes /usr/local/bin/runner.sh which:
  1. Applies patches in order (tests first, then features)
  2. Runs the test suite
  3. Reports results
Usage:

Parsing test output

Environment variables

Environments can be configured with environment variables:

Building custom environments

Dockerfile structure

Create a Dockerfile for your custom task:

Test runner script

Create runner.sh:

Build and push image

Use custom image

Advanced usage

Multi-step execution

Copy files from sandbox

Environment debugging

Best practices

Always cleanup sandboxes

Handle timeouts gracefully

Reuse images