Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Fix Docker installation for swebench and mswebench images (#10124)

Xingyao Wang0d28113df1d5
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 %}