Pradana Adnyana
11/20/2025, 8:40 AMdocker.errors.APIError: 400 Client Error for <http+docker://localhost/v1.52/containers/0be05e44b07b4e863990b357e9ea002c3283f242391a19bed2e48c48941834cc/start>: Bad Request ("failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: exec: "prefect": executable file not found in $PATH")
16:37:10.211 | INFO | prefect.flow_runs.worker - Reported flow run '818d84b3-775f-45f6-b857-55108b804eaf' as crashed: Flow run could not be submitted to infrastructure:
APIError(HTTPError('400 Client Error: Bad Request for url: <http+docker://localhost/v1.52/containers/0be05e44b07b4e863990b357e9ea002c3283f242391a19bed2e48c48941834cc/start'))>
from src.flows.collect_to_parquete import collect_to_parquet_flow
if __name__ == "__main__":
deploy(
collect_to_parquet_flow.to_deployment(name="collect_to_parquet_flow"), # pyright: ignore[reportArgumentType]
work_pool_name="docker-pool",
image=DockerImage(
name="wwwaste-data-pipeline",
tag="v2",
dockerfile="deployments/docker/Dockerfile",
),
build=True,
push=False,
)
Dockerfile
FROM python:3.14-slim-trixie
# The installer requires curl (and certificates) to download the release archive
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
ca-certificates \
libgomp1 \
build-essential\
gcc libpq-dev\
&& rm -rf /var/lib/apt/lists/*
# Download the latest installer
ADD <https://astral.sh/uv/install.sh> /uv-installer.sh
# Run the installer then remove it
RUN sh /uv-installer.sh && rm /uv-installer.sh
# Ensure the installed binary is on the `PATH`
ENV PATH="/root/.local/bin/:$PATH"
ENV export PYTHONPATH=$PYTHONPATH:.
WORKDIR /app
COPY pyproject.toml uv.lock ./
RUN uv sync
RUN uv run prefect --version
COPY . /appMarvin
11/20/2025, 8:40 AMMarvin
11/20/2025, 8:45 AMprefect flow-run execute
If your image doesn’t have the prefect CLI on PATH, Docker will fail with:
exec: "prefect": executable file not found in $PATH
How to fix it
Pick one of these:
1) Base your image on Prefect’s official image (recommended)
- The prefect CLI is already installed.
Dockerfile:
FROM prefecthq/prefect:3-latest
WORKDIR /opt/prefect/app
# Optional sanity checks
RUN prefect version && which prefect
# Install your deps
COPY requirements.txt .
RUN uv pip install -r requirements.txt
# Copy your code
COPY . .
2) If you must use a custom base image, install Prefect explicitly
FROM python:3.12-slim
# CRITICAL: install Prefect so `prefect` is on PATH
RUN pip install --no-cache-dir prefect
WORKDIR /app
# Optional sanity checks
RUN prefect version && which prefect
# Install your deps and copy code
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
Sanity-check your image locally before deploying:
docker build -t wwwaste-data-pipeline:v2 -f deployments/docker/Dockerfile .
docker run --rm wwwaste-data-pipeline:v2 prefect version
docker run --rm wwwaste-data-pipeline:v2 which prefect
Notes specific to your deployment snippet
- Your DockerImage(..., dockerfile="deployments/docker/Dockerfile", build=True) is fine, but make sure that Dockerfile includes Prefect as shown above (either via FROM prefecthq/prefect:3-latest or pip install prefect).
- If your Docker worker runs on a different host than where you’re building, set push=True and give the image a registry-qualified name so the worker can pull it. This isn’t the cause of the current error, but it’s a common next gotcha.
Why this is required
- The Docker worker relies on the Prefect CLI to bootstrap flow execution in the container. Without the prefect executable available, the container cannot start the flow.
If you can share your deployments/docker/Dockerfile, I can suggest the minimal change needed.
Helpful links
- Prefect Docker image on Docker Hub: prefecthq/prefect
- Work pools overview: Work pools concepts
- Deployments overview: Deployments