From 0d28113df1d542c468863cc21a999432354a3149 Mon Sep 17 00:00:00 2001 From: Xingyao Wang Date: Thu, 7 Aug 2025 11:42:35 -0400 Subject: [PATCH] Fix Docker installation for swebench and mswebench images (#10124) Co-authored-by: openhands --- .../runtime/utils/runtime_templates/Dockerfile.j2 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/openhands/runtime/utils/runtime_templates/Dockerfile.j2 b/openhands/runtime/utils/runtime_templates/Dockerfile.j2 index 2857d454d5..de98f77733 100644 --- a/openhands/runtime/utils/runtime_templates/Dockerfile.j2 +++ b/openhands/runtime/utils/runtime_templates/Dockerfile.j2 @@ -68,12 +68,14 @@ RUN mkdir -p /openhands && \ # ================================================================ +# Define Docker installation macro +{% macro install_docker() %} # Install Docker following official documentation # https://docs.docker.com/engine/install/ubuntu/ # https://docs.docker.com/engine/install/debian/ RUN \ # Determine OS type and install accordingly - if [[ "{{ base_image }}" == *"ubuntu"* ]] || [[ "{{ base_image }}" == *"mswebench"* ]]; then \ + if [[ "{{ base_image }}" == *"ubuntu"* ]]; then \ # Handle Ubuntu (following https://docs.docker.com/engine/install/ubuntu/) # Add Docker's official GPG key apt-get update && \ @@ -109,6 +111,12 @@ RUN \ # Configure Docker daemon with MTU 1450 to prevent packet fragmentation issues RUN mkdir -p /etc/docker && \ echo '{"mtu": 1450}' > /etc/docker/daemon.json +{% endmacro %} + +# Install Docker only if not a swebench or mswebench image +{% if not ('swebench' in base_image) and not ('mswebench' in base_image) %} +{{ install_docker() }} +{% endif %} # ================================================================ {% endmacro %}