DOCKSMITH: Scaling Reliable Coding Environments via an Agentic Docker Builder

Jiaran Zhang, Lu Ma, Yanhao Li, Fanqi Wan, Di Qi, Xin Wu, Zhewei Huang, Liangyu Chen, Yingwei Ma, Qi Han, Xiangyu Zhang

Introduction

For an AI software engineering (SWE) agent to fix a bug or implement a feature, it first needs a place to run and test its code. In practice, this means building a Docker container that perfectly mirrors a repository's environment—complete with the right compilers, libraries, and system dependencies. DOCKSMITH is a specialized 30B-parameter agentic model designed to solve this "it works on my machine" curse for AI agents. By treating Docker environment construction as a core reasoning task rather than a tedious prerequisite, DOCKSMITH achieves state-of-the-art performance in setting up executable environments and demonstrates that these skills transfer directly to better bug-fixing and tool-use capabilities.

The Bottleneck of Environment Setup

Currently, environment construction is a massive bottleneck for scaling AI agents. Setup is notoriously brittle; even top-tier models like Claude 4 often fail to resolve complex dependency conflicts or undocumented build requirements. This failure prevents researchers from scaling up "execution-grounded" training, where agents learn from the actual results of running code. Simply put: if you cannot build the environment, you cannot run the tests, and the agent cannot learn from its mistakes.

Methodology: Building DOCKSMITH

To navigate the long-horizon task of environment building, the authors developed a specialized approach consisting of an agentic data pipeline and a targeted training regimen.

Agentic Data Pipeline

The researchers extended the SWE-Factory framework to create a multi-agent system comprising Context Retrieval, Dockerfile Generation, Eval Script, and Test Analysis agents. To make this pipeline robust, they introduced two critical features:

  • Loop Detection: A controller that intervenes when agents get stuck in repetitive "try-fail-retry" diagnostic loops.
  • Cross-Task Memory: A pool of successful solutions that agents can reference when facing similar repositories. Breaking a loop only helps if the agent has a better strategy to switch to; this memory provides that alternative.

Specialized Training

Using a corpus of 692,000 trajectory steps—crawled from over 200,000 high-quality, merged GitHub Pull Requests across 15,000+ repositories—the authors fine-tuned a 30B-A3B model. The training process utilized:

  • Acceptance Shaping: Filtering out redundant or low-quality trajectories to maintain a high-density training signal.
  • Complexity Curriculum: Sampling harder builds (those with more dependencies or complex instructions) more frequently using Z-score normalization. This ensures the model learns to handle difficult cases rather than over-representing trivial builds.
  • Joint Training: Mixing Docker-building data with general SWE-solving data to ensure the model remains a capable generalist.

Key Results and Transferability

DOCKSMITH acts as a reliable "shovel" that enables the automated creation of high-quality training data for other agents. Its performance sets new standards across multiple benchmarks:

  • State-of-the-Art Performance: DOCKSMITH achieved a 39.72% Fail-to-Pass (F2P) rate on Multi-Docker-Eval, surpassing the previous upper bound of 37.7% and outperforming closed-source models like Claude-4-Sonnet and Gemini-2.5-Flash.
  • Massive Generalization Gains: On EnvBench (JVM), DOCKSMITH achieved a 73.08% pass rate, a dramatic improvement from the base model's 10.53%.
  • Error Reduction: The model reduced total errors by 42.5% compared to baselines, specifically excelling at avoiding diagnostic loops and Dockerfile rollbacks.
  • Transferable "Gritty" Skills: One of the most significant findings is that learning to build environments makes an agent better at general coding. Reasoning about dependencies and system-level conflicts translates to better performance on downstream tasks, yielding improvements on SWE-bench Verified and a +3.37 point boost on Terminal-Bench 2.0.

Limitations and Future Work

While DOCKSMITH excels in ecosystems like Python and Go, it still faces challenges with low-level languages like C/C++ and Rust, where compiler toolchains and system-level dependencies are significantly more complex. Furthermore, error analysis indicates that while high-level reasoning has improved, low-level command precision (e.g., shell syntax) remains a secondary bottleneck. Finally, automating environment construction involves executing arbitrary code from the web, necessitating rigorous sandboxing and responsible deployment to prevent security risks.

Summary updated

BibTeX
@inproceedings{zhang2026docksmith,
  author = {Jiaran Zhang and Lu Ma and Yanhao Li and Fanqi Wan and DI QI and Xin Wu and Zhewei Huang and Liangyu Chen and YINGWEI MA and Qi Han and Xiangyu Zhang},
  title = {{DOCKSMITH: Scaling Reliable Coding Environments via an Agentic Docker Builder}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=tRbgtWwmHB},
}
Figure