nemo_gym.sandbox.compose_config
nemo_gym.sandbox.compose_config
Turn a published Harbor Compose overlay into a document the sandbox Compose adapter can start.
Harbor publishes environment/docker-compose.yaml as an overlay on its own base file: the
main service is the task image, sidecars are prebuilt images. Starting it without Docker
needs each image’s recorded OCI configuration (entrypoint, command, user, exposed ports,
healthcheck), which image_configs supplies, keyed by image reference.
Adapted from Gym’s Terminal Bench 4 server (resources_servers/terminal_bench_4/compose_config.py).
Module Contents
Functions
API
Whether value is exactly one URL whose host is a Compose service, the shape resolve_environment rewrites.
A compound value (Kafka’s comma-separated KAFKA_ADVERTISED_LISTENERS) parses to a hostname too, but
its port text is not a number and the adapter would fail reading it; it is left as written.
Keep a sidecar on its image’s default non-root user without host-file injection.
A non-root process cannot edit /etc/hosts, so peer names are resolved into the
environment variables that carry http://<service> URLs instead, and the explicit
user copied from image metadata is dropped so the provider does not try to su
to the user it already runs as. Mutates and returns document.
OpenSandbox takes a service’s shared-memory size as a label. Mutates and returns document.
Apply Harbor’s prebuilt-image base and normalize the published task overlay.