[ { "id": "sbd-0001", "title": "Python image forgets requirements.txt", "summary": "The Dockerfile installs from requirements.txt before that file exists inside the build context layer.", "failure_type": "missing_build_context_file", "ecosystem": "python", "difficulty": "easy", "tags": [ "dockerfile", "python", "build-context", "pip" ], "files": [ { "path": "Dockerfile", "content": [ "FROM python:3.12-slim", "WORKDIR /app", "COPY app.py .", "RUN pip install --no-cache-dir -r requirements.txt", "CMD [\"python\", \"app.py\"]" ] }, { "path": "requirements.txt", "content": [ "flask==3.0.3" ] }, { "path": "app.py", "content": [ "from flask import Flask", "", "app = Flask(__name__)", "", "@app.get(\"/\")", "def home():", " return {\"status\": \"ok\"}", "", "if __name__ == \"__main__\":", " app.run(host=\"0.0.0.0\", port=8080)" ] } ], "failure_log": [ "Step 4/5 : RUN pip install --no-cache-dir -r requirements.txt", "ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'" ], "build": { "command": "docker build -t sabnock/sbd-0001 ." }, "verify": { "commands": [ "docker build -t sabnock/sbd-0001 ." ] }, "oracle_patch": [ "diff --git a/Dockerfile b/Dockerfile", "--- a/Dockerfile", "+++ b/Dockerfile", "@@ -1,5 +1,6 @@", " FROM python:3.12-slim", " WORKDIR /app", "-COPY app.py .", "+COPY requirements.txt .", " RUN pip install --no-cache-dir -r requirements.txt", "+COPY app.py .", " CMD [\"python\", \"app.py\"]" ], "scoring": { "must_touch": [ "Dockerfile" ], "must_contain": [ { "path": "Dockerfile", "text": "COPY requirements.txt ." } ], "must_not_contain": [] }, "split": "seed" }, { "id": "sbd-0002", "title": "Node image uses npm ci without a lockfile", "summary": "The project has only package.json, but the Dockerfile uses npm ci, which requires a package-lock.json or npm-shrinkwrap.json.", "failure_type": "lockfile_missing", "ecosystem": "node", "difficulty": "easy", "tags": [ "dockerfile", "node", "npm", "lockfile" ], "files": [ { "path": "Dockerfile", "content": [ "FROM node:22-alpine", "WORKDIR /app", "COPY package.json .", "RUN npm ci --omit=dev", "COPY index.js .", "CMD [\"node\", \"index.js\"]" ] }, { "path": "package.json", "content": [ "{\"scripts\":{\"start\":\"node index.js\"},\"dependencies\":{\"express\":\"4.19.2\"}}" ] }, { "path": "index.js", "content": [ "const express = require('express');", "const app = express();", "app.get('/', (_req, res) => res.json({status: 'ok'}));", "app.listen(3000, '0.0.0.0');" ] } ], "failure_log": [ "npm ERR! code EUSAGE", "npm ERR! The `npm ci` command can only install with an existing package-lock.json or npm-shrinkwrap.json." ], "build": { "command": "docker build -t sabnock/sbd-0002 ." }, "verify": { "commands": [ "docker build -t sabnock/sbd-0002 ." ] }, "oracle_patch": [ "diff --git a/Dockerfile b/Dockerfile", "--- a/Dockerfile", "+++ b/Dockerfile", "@@ -1,6 +1,6 @@", " FROM node:22-alpine", " WORKDIR /app", " COPY package.json .", "-RUN npm ci --omit=dev", "+RUN npm install --omit=dev", " COPY index.js .", " CMD [\"node\", \"index.js\"]" ], "scoring": { "must_touch": [ "Dockerfile" ], "must_contain": [ { "path": "Dockerfile", "text": "RUN npm install --omit=dev" } ], "must_not_contain": [] }, "split": "seed" }, { "id": "sbd-0003", "title": "Go multi-stage build copies the wrong binary", "summary": "The builder stage writes /out/server, but the runtime stage tries to copy and execute /out/api.", "failure_type": "multistage_artifact_mismatch", "ecosystem": "go", "difficulty": "easy", "tags": [ "dockerfile", "go", "multi-stage", "copy" ], "files": [ { "path": "Dockerfile", "content": [ "FROM golang:1.23-alpine AS build", "WORKDIR /src", "COPY go.mod ./", "COPY main.go ./", "RUN go build -o /out/server ./...", "FROM alpine:3.20", "COPY --from=build /out/api /usr/local/bin/api", "CMD [\"api\"]" ] }, { "path": "go.mod", "content": [ "module example.com/sabnock/sbd0003", "", "go 1.23" ] }, { "path": "main.go", "content": [ "package main", "", "import \"fmt\"", "", "func main() {", " fmt.Println(\"ok\")", "}" ] } ], "failure_log": [ "failed to solve: failed to compute cache key: failed to calculate checksum of ref: \"/out/api\": not found" ], "build": { "command": "docker build -t sabnock/sbd-0003 ." }, "verify": { "commands": [ "docker build -t sabnock/sbd-0003 ." ] }, "oracle_patch": [ "diff --git a/Dockerfile b/Dockerfile", "--- a/Dockerfile", "+++ b/Dockerfile", "@@ -3,6 +3,6 @@", " COPY go.mod ./", " COPY main.go ./", " RUN go build -o /out/server ./...", " FROM alpine:3.20", "-COPY --from=build /out/api /usr/local/bin/api", "-CMD [\"api\"]", "+COPY --from=build /out/server /usr/local/bin/server", "+CMD [\"server\"]" ], "scoring": { "must_touch": [ "Dockerfile" ], "must_contain": [ { "path": "Dockerfile", "text": "/out/server /usr/local/bin/server" }, { "path": "Dockerfile", "text": "CMD [\"server\"]" } ], "must_not_contain": [] }, "split": "seed" }, { "id": "sbd-0004", "title": "Compose API starts before Postgres is ready", "summary": "depends_on only controls startup order. The API starts while Postgres is still initializing, so integration tests see connection refused.", "failure_type": "compose_readiness", "ecosystem": "compose", "difficulty": "medium", "tags": [ "compose", "postgres", "healthcheck", "integration-test" ], "files": [ { "path": "docker-compose.yml", "content": [ "services:", " api:", " build: .", " environment:", " DATABASE_URL: postgres://postgres:postgres@db:5432/postgres", " depends_on:", " - db", " db:", " image: postgres:16-alpine", " environment:", " POSTGRES_PASSWORD: postgres" ] }, { "path": "Dockerfile", "content": [ "FROM python:3.12-slim", "WORKDIR /app", "COPY app.py .", "CMD [\"python\", \"app.py\"]" ] }, { "path": "app.py", "content": [ "import os", "print(os.environ['DATABASE_URL'])" ] } ], "failure_log": [ "api-1 | psycopg.OperationalError: connection failed: Connection refused", "db-1 | database system is ready to accept connections" ], "build": { "command": "docker compose up --build --abort-on-container-exit" }, "verify": { "commands": [ "docker compose config --quiet" ] }, "oracle_patch": [ "diff --git a/docker-compose.yml b/docker-compose.yml", "--- a/docker-compose.yml", "+++ b/docker-compose.yml", "@@ -1,11 +1,16 @@", " services:", " api:", " build: .", " environment:", " DATABASE_URL: postgres://postgres:postgres@db:5432/postgres", " depends_on:", "- - db", "+ db:", "+ condition: service_healthy", " db:", " image: postgres:16-alpine", " environment:", " POSTGRES_PASSWORD: postgres", "+ healthcheck:", "+ test: [\"CMD-SHELL\", \"pg_isready -U postgres\"]", "+ interval: 2s", "+ timeout: 3s", "+ retries: 20" ], "scoring": { "must_touch": [ "docker-compose.yml" ], "must_contain": [ { "path": "docker-compose.yml", "text": "condition: service_healthy" }, { "path": "docker-compose.yml", "text": "pg_isready -U postgres" } ], "must_not_contain": [] }, "split": "seed" }, { "id": "sbd-0005", "title": ".dockerignore excludes the production dist directory", "summary": "The image is supposed to serve an already-built static site, but .dockerignore removes dist from the build context.", "failure_type": "dockerignore_artifact_excluded", "ecosystem": "frontend", "difficulty": "easy", "tags": [ "dockerfile", "dockerignore", "nginx", "static-site" ], "files": [ { "path": "Dockerfile", "content": [ "FROM nginx:1.27-alpine", "COPY dist/ /usr/share/nginx/html/" ] }, { "path": ".dockerignore", "content": [ "node_modules", "dist" ] }, { "path": "dist/index.html", "content": [ "", "ok" ] } ], "failure_log": [ "failed to compute cache key: failed to calculate checksum of ref: \"/dist\": not found" ], "build": { "command": "docker build -t sabnock/sbd-0005 ." }, "verify": { "commands": [ "docker build -t sabnock/sbd-0005 ." ] }, "oracle_patch": [ "diff --git a/.dockerignore b/.dockerignore", "--- a/.dockerignore", "+++ b/.dockerignore", "@@ -1,2 +1 @@", " node_modules", "-dist" ], "scoring": { "must_touch": [ ".dockerignore" ], "must_contain": [], "must_not_contain": [ { "path": ".dockerignore", "text": "dist" } ] }, "split": "seed" }, { "id": "sbd-0006", "title": "Rust Alpine build misses OpenSSL native packages", "summary": "The crate depends on openssl, but the Alpine builder does not install the native headers and pkg-config needed by openssl-sys.", "failure_type": "native_dependency_missing", "ecosystem": "rust", "difficulty": "medium", "tags": [ "dockerfile", "rust", "alpine", "openssl", "native-deps" ], "files": [ { "path": "Dockerfile", "content": [ "FROM rust:1.79-alpine AS build", "WORKDIR /src", "COPY Cargo.toml .", "RUN cargo fetch", "COPY src ./src", "RUN cargo build --release" ] }, { "path": "Cargo.toml", "content": [ "[package]", "name = \"sbd0006\"", "version = \"0.1.0\"", "edition = \"2021\"", "", "[dependencies]", "openssl = \"0.10\"" ] }, { "path": "src/main.rs", "content": [ "fn main() {", " println!(\"ok\");", "}" ] } ], "failure_log": [ "error: failed to run custom build command for `openssl-sys`", "Could not find directory of OpenSSL installation, and this `-sys` crate cannot proceed without this knowledge." ], "build": { "command": "docker build -t sabnock/sbd-0006 ." }, "verify": { "commands": [ "docker build -t sabnock/sbd-0006 ." ] }, "oracle_patch": [ "diff --git a/Dockerfile b/Dockerfile", "--- a/Dockerfile", "+++ b/Dockerfile", "@@ -1,6 +1,7 @@", " FROM rust:1.79-alpine AS build", " WORKDIR /src", "+RUN apk add --no-cache musl-dev pkgconfig openssl-dev", " COPY Cargo.toml .", " RUN cargo fetch", " COPY src ./src", " RUN cargo build --release" ], "scoring": { "must_touch": [ "Dockerfile" ], "must_contain": [ { "path": "Dockerfile", "text": "apk add --no-cache musl-dev pkgconfig openssl-dev" } ], "must_not_contain": [] }, "split": "seed" }, { "id": "sbd-0007", "title": "Python src layout is not importable in the container", "summary": "The app lives under src/app, but the container runs python -m app without adding /app/src to PYTHONPATH.", "failure_type": "python_src_layout_import", "ecosystem": "python", "difficulty": "easy", "tags": [ "dockerfile", "python", "src-layout", "runtime" ], "files": [ { "path": "Dockerfile", "content": [ "FROM python:3.12-slim", "WORKDIR /app", "COPY requirements.txt .", "RUN pip install --no-cache-dir -r requirements.txt", "COPY src ./src", "CMD [\"python\", \"-m\", \"app\"]" ] }, { "path": "requirements.txt", "content": [] }, { "path": "src/app/__main__.py", "content": [ "print(\"ok\")" ] } ], "failure_log": [ "/usr/local/bin/python: No module named app" ], "build": { "command": "docker build -t sabnock/sbd-0007 ." }, "verify": { "commands": [ "docker build -t sabnock/sbd-0007 .", "docker run --rm sabnock/sbd-0007" ] }, "oracle_patch": [ "diff --git a/Dockerfile b/Dockerfile", "--- a/Dockerfile", "+++ b/Dockerfile", "@@ -3,4 +3,5 @@", " COPY requirements.txt .", " RUN pip install --no-cache-dir -r requirements.txt", " COPY src ./src", "+ENV PYTHONPATH=/app/src", " CMD [\"python\", \"-m\", \"app\"]" ], "scoring": { "must_touch": [ "Dockerfile" ], "must_contain": [ { "path": "Dockerfile", "text": "ENV PYTHONPATH=/app/src" } ], "must_not_contain": [] }, "split": "seed" }, { "id": "sbd-0008", "title": "Poetry install tries to install the app before source files exist", "summary": "The Dockerfile copies only pyproject.toml, then runs poetry install. Poetry attempts to install the root project and fails because package metadata/source files are not present yet.", "failure_type": "poetry_root_install_order", "ecosystem": "python", "difficulty": "medium", "tags": [ "dockerfile", "python", "poetry", "dependency-install" ], "files": [ { "path": "Dockerfile", "content": [ "FROM python:3.12-slim", "WORKDIR /app", "RUN pip install --no-cache-dir poetry==1.8.3", "COPY pyproject.toml ./", "RUN poetry install --only main", "COPY service ./service", "CMD [\"poetry\", \"run\", \"python\", \"-m\", \"service\"]" ] }, { "path": "pyproject.toml", "content": [ "[tool.poetry]", "name = \"sbd0008\"", "version = \"0.1.0\"", "description = \"synthetic task\"", "authors = [\"Sabnock \"]", "packages = [{ include = \"service\" }]", "", "[tool.poetry.dependencies]", "python = \"^3.12\"", "", "[build-system]", "requires = [\"poetry-core\"]", "build-backend = \"poetry.core.masonry.api\"" ] }, { "path": "service/__main__.py", "content": [ "print(\"ok\")" ] } ], "failure_log": [ "Installing the current project: sbd0008 (0.1.0)", "Error: The current project could not be installed: No file/folder found for package service" ], "build": { "command": "docker build -t sabnock/sbd-0008 ." }, "verify": { "commands": [ "docker build -t sabnock/sbd-0008 ." ] }, "oracle_patch": [ "diff --git a/Dockerfile b/Dockerfile", "--- a/Dockerfile", "+++ b/Dockerfile", "@@ -2,6 +2,6 @@", " WORKDIR /app", " RUN pip install --no-cache-dir poetry==1.8.3", " COPY pyproject.toml ./", "-RUN poetry install --only main", "+RUN poetry install --only main --no-root", " COPY service ./service", " CMD [\"poetry\", \"run\", \"python\", \"-m\", \"service\"]" ], "scoring": { "must_touch": [ "Dockerfile" ], "must_contain": [ { "path": "Dockerfile", "text": "poetry install --only main --no-root" } ], "must_not_contain": [] }, "split": "seed" }, { "id": "sbd-0009", "title": "Compose bind mount hides node_modules from the image", "summary": "The image installs dependencies, but docker compose bind-mounts the host project over /app. On a clean host without node_modules, runtime imports fail.", "failure_type": "compose_bind_mount_masks_dependencies", "ecosystem": "node", "difficulty": "medium", "tags": [ "compose", "node", "bind-mount", "node_modules" ], "files": [ { "path": "docker-compose.yml", "content": [ "services:", " web:", " build: .", " command: npm start", " volumes:", " - .:/app" ] }, { "path": "Dockerfile", "content": [ "FROM node:22-alpine", "WORKDIR /app", "COPY package.json .", "RUN npm install", "COPY index.js .", "CMD [\"npm\", \"start\"]" ] }, { "path": "package.json", "content": [ "{\"scripts\":{\"start\":\"node index.js\"},\"dependencies\":{\"express\":\"4.19.2\"}}" ] }, { "path": "index.js", "content": [ "require('express')().listen(3000, '0.0.0.0');" ] } ], "failure_log": [ "web-1 | Error: Cannot find module 'express'", "web-1 | Require stack: /app/index.js" ], "build": { "command": "docker compose up --build" }, "verify": { "commands": [ "docker compose config --quiet" ] }, "oracle_patch": [ "diff --git a/docker-compose.yml b/docker-compose.yml", "--- a/docker-compose.yml", "+++ b/docker-compose.yml", "@@ -3,4 +3,5 @@", " build: .", " command: npm start", " volumes:", " - .:/app", "+ - /app/node_modules" ], "scoring": { "must_touch": [ "docker-compose.yml" ], "must_contain": [ { "path": "docker-compose.yml", "text": "/app/node_modules" } ], "must_not_contain": [] }, "split": "seed" }, { "id": "sbd-0010", "title": "Dockerfile leaks an npm token through ARG and image layers", "summary": "The build uses ARG NPM_TOKEN and writes it to .npmrc in a RUN layer. A secure fix should use BuildKit secrets and remove the temporary .npmrc.", "failure_type": "build_secret_leak", "ecosystem": "node", "difficulty": "hard", "tags": [ "dockerfile", "node", "buildkit", "secrets", "security" ], "files": [ { "path": "Dockerfile", "content": [ "FROM node:22-alpine", "WORKDIR /app", "ARG NPM_TOKEN", "COPY package*.json ./", "RUN echo \"//registry.npmjs.org/:_authToken=${NPM_TOKEN}\" > .npmrc && npm ci --omit=dev", "COPY index.js .", "CMD [\"node\", \"index.js\"]" ] }, { "path": "package.json", "content": [ "{\"scripts\":{\"start\":\"node index.js\"},\"dependencies\":{\"left-pad\":\"1.3.0\"}}" ] }, { "path": "package-lock.json", "content": [ "{\"name\":\"sbd0010\",\"lockfileVersion\":3,\"packages\":{}}" ] }, { "path": "index.js", "content": [ "console.log('ok')" ] } ], "failure_log": [ "hadolint: SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data", "security-scan: token material may persist in image layer history" ], "build": { "command": "DOCKER_BUILDKIT=1 docker build --secret id=npm_token,src=.npm-token -t sabnock/sbd-0010 ." }, "verify": { "commands": [ "docker buildx build --check ." ] }, "oracle_patch": [ "diff --git a/Dockerfile b/Dockerfile", "--- a/Dockerfile", "+++ b/Dockerfile", "@@ -1,7 +1,7 @@", "+# syntax=docker/dockerfile:1.7", " FROM node:22-alpine", " WORKDIR /app", "-ARG NPM_TOKEN", " COPY package*.json ./", "-RUN echo \"//registry.npmjs.org/:_authToken=${NPM_TOKEN}\" > .npmrc && npm ci --omit=dev", "+RUN --mount=type=secret,id=npm_token sh -c 'echo \"//registry.npmjs.org/:_authToken=$(cat /run/secrets/npm_token)\" > .npmrc && npm ci --omit=dev && rm .npmrc'", " COPY index.js .", " CMD [\"node\", \"index.js\"]" ], "scoring": { "must_touch": [ "Dockerfile" ], "must_contain": [ { "path": "Dockerfile", "text": "# syntax=docker/dockerfile:1.7" }, { "path": "Dockerfile", "text": "--mount=type=secret,id=npm_token" }, { "path": "Dockerfile", "text": "rm .npmrc" } ], "must_not_contain": [ { "path": "Dockerfile", "text": "ARG NPM_TOKEN" }, { "path": "Dockerfile", "text": "${NPM_TOKEN}" } ] }, "split": "seed" }, { "id": "sbd-0011", "title": "Ubuntu image installs apt packages without apt-get update", "summary": "The package install runs against an image with no fresh package lists, causing apt to fail in a clean build.", "failure_type": "apt_update_missing", "ecosystem": "linux", "difficulty": "easy", "tags": [ "dockerfile", "apt", "ubuntu", "package-install" ], "files": [ { "path": "Dockerfile", "content": [ "FROM ubuntu:24.04", "RUN apt-get install -y curl ca-certificates", "CMD [\"curl\", \"--version\"]" ] } ], "failure_log": [ "Reading package lists...", "E: Unable to locate package curl", "E: Unable to locate package ca-certificates" ], "build": { "command": "docker build -t sabnock/sbd-0011 ." }, "verify": { "commands": [ "docker build -t sabnock/sbd-0011 ." ] }, "oracle_patch": [ "diff --git a/Dockerfile b/Dockerfile", "--- a/Dockerfile", "+++ b/Dockerfile", "@@ -1,3 +1,3 @@", " FROM ubuntu:24.04", "-RUN apt-get install -y curl ca-certificates", "+RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates && rm -rf /var/lib/apt/lists/*", " CMD [\"curl\", \"--version\"]" ], "scoring": { "must_touch": [ "Dockerfile" ], "must_contain": [ { "path": "Dockerfile", "text": "apt-get update && apt-get install" }, { "path": "Dockerfile", "text": "rm -rf /var/lib/apt/lists/*" } ], "must_not_contain": [] }, "split": "seed" }, { "id": "sbd-0012", "title": "FastAPI container binds to localhost", "summary": "The app starts inside the container, but Uvicorn binds to 127.0.0.1. Published ports on the host cannot reach it.", "failure_type": "container_network_binding", "ecosystem": "python", "difficulty": "easy", "tags": [ "dockerfile", "fastapi", "uvicorn", "runtime", "network" ], "files": [ { "path": "Dockerfile", "content": [ "FROM python:3.12-slim", "WORKDIR /app", "COPY requirements.txt .", "RUN pip install --no-cache-dir -r requirements.txt", "COPY main.py .", "EXPOSE 8000", "CMD [\"uvicorn\", \"main:app\", \"--host\", \"127.0.0.1\", \"--port\", \"8000\"]" ] }, { "path": "requirements.txt", "content": [ "fastapi==0.111.0", "uvicorn[standard]==0.30.1" ] }, { "path": "main.py", "content": [ "from fastapi import FastAPI", "", "app = FastAPI()", "", "@app.get('/health')", "def health():", " return {'status': 'ok'}" ] } ], "failure_log": [ "curl: (56) Recv failure: Connection reset by peer", "container log: Uvicorn running on http://127.0.0.1:8000" ], "build": { "command": "docker build -t sabnock/sbd-0012 ." }, "verify": { "commands": [ "docker build -t sabnock/sbd-0012 ." ] }, "oracle_patch": [ "diff --git a/Dockerfile b/Dockerfile", "--- a/Dockerfile", "+++ b/Dockerfile", "@@ -4,4 +4,4 @@", " RUN pip install --no-cache-dir -r requirements.txt", " COPY main.py .", " EXPOSE 8000", "-CMD [\"uvicorn\", \"main:app\", \"--host\", \"127.0.0.1\", \"--port\", \"8000\"]", "+CMD [\"uvicorn\", \"main:app\", \"--host\", \"0.0.0.0\", \"--port\", \"8000\"]" ], "scoring": { "must_touch": [ "Dockerfile" ], "must_contain": [ { "path": "Dockerfile", "text": "0.0.0.0" } ], "must_not_contain": [] }, "split": "seed" } ]