Safeguard
Developer Tools•

What is repo2docker, and does it make a research repository reproducible?

repo2docker builds an environment from files like requirements.txt. It automates good practice, but unpinned files still give different results over time.

Safeguard Security Team
3 min read

repo2docker is a tool that scans a repository for configuration files, such as requirements.txt, and builds a computing environment from them. It automates community practice, but it only makes a repository reproducible when those files pin exact versions. Unpinned files give you a different environment each time.

What the specification says

The repo2docker documentation calls the set of supported files, their contents and the actions taken the Reproducible Execution Environment Specification, or REES. The stated goal is to automate and encourage existing best practices for reproducible computational environments, using community standard files and tools: requirements.txt with pip, Project.toml for Julia, apt.txt for apt, and others.

A design point is worth quoting in spirit. The docs say a human should be able to look at a REES compliant repository and reproduce the environment using clear steps without the repo2docker software. So the files are the record, and the tool is a convenience.

The configuration files must sit in the repository root, in a binder directory or in a dot binder directory.

Where reproducibility can leak

The documentation says a REES compliant tool will install a Python interpreter of unspecified version and perform the equivalent of pip install with the requirements file. That wording matters. If you do not state the Python version and the package versions, you have not fixed them.

InputReproducible?
requirements.txt with exact versions and hashesMuch closer
requirements.txt with loose rangesDrifts over time
No Python version statedInterpreter may differ
apt.txt with no versionsSystem libraries may differ

Steps to tighten a Binder style repository

  1. Pin every Python package to an exact version. Add hashes where practical. See generate hashes for a requirements file.
  2. State the interpreter version using the mechanism the docs describe for your language.
  3. Pin or record system packages, since apt installs also change.
  4. Rebuild from scratch in CI on a schedule and fail when the result changes.
  5. Scan the pinned set for known vulnerabilities, and decide on updates deliberately.
  6. Never put tokens in the repository, because a public environment repository is public. See how to keep API keys out of Jupyter notebooks.

Security note

An environment built from public files and run in a hosted service should be treated as untrusted compute. Do not mount secrets into it, and do not assume the people running it are you.

Try it yourself

Click through it at your own pace, or open it full screen. Look at how exact versions and transitive packages are listed, the same facts you need pinned in your requirements file.

Quick check

Does repo2docker pin my dependencies for me?

No. It installs what your files specify. If the files use loose versions, the result can change between builds.

Where do the configuration files go?

In the repository root, or in a binder or dot binder subdirectory, per the repo2docker specification.

Safeguard's SBOM and dependency scanning reads requirements files and lockfiles, and a free scan is available.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.