<@ULVA73B9P> I'm deploying flows to an azure ACI p...
# ask-marvin
z
@Marvin I'm deploying flows to an azure ACI push work pool. I'm using a custom docker image built from a UV base image with my UV project dependencies, and I'm pulling project code from github source at runtime. I cannot figure out how to override the container start command /opt/prefect/entrypoint.sh so my container fails to start. How can I set up my prefect.yml and dockerfile to properly use a custom base image where prefect is installed into my image as a python dependency, rather than using the prefect base image. The /opt/prefect/entrypoint.sh file is not in the image
m
thought for 526.1 seconds
You're right:
/opt/prefect/entrypoint.sh
only exists in Prefect’s base images. When you use a custom image (like a UV base), you must not rely on that script. In Prefect 3.x, the ACI worker injects the correct command to run your flow; you just need Prefect installed in the container and ensure the ACI job template does not force an entrypoint pointing at that script. Key points - There is no ACI requirement for
/opt/prefect/entrypoint.sh
. That’s a convenience in Prefect’s base images. - The ACI work pool job template supports
entrypoint
and
command
variables. The worker populates
{{ command }}
with the correct flow-run command at runtime. If your template (or deployment) forces an entrypoint to
/opt/prefect/entrypoint.sh
, the container will fail if that file isn’t present. - Fix: set
entrypoint
to an empty list (or omit it) so ACI uses your image’s default entrypoint and runs the Prefect-supplied
command
. Docs for reference - Azure ACI worker (Prefect 3) - prefect.yaml schema - You can inspect the default ACI job template (note the
entrypoint
and
command
placeholders):
Copy code
prefect work-pool get-default-base-job-template --type azure-container-instance:push
Option A — Set
entrypoint
at the deployment level (recommended) Add
entrypoint: []
in your
prefect.yaml
deployment’s
job_variables
. Do not set
command
— let the worker populate it. Example prefect.yaml
Copy code
name: aci-uv-project
prefect-version: ">=3.0.0"

deployments:
  - name: my-flow-prod
    entrypoint: flows/my_flow.py:flow  # path in your GitHub repo
    work_pool:
      name: aci-push
      type: azure-container-instance:push
      job_variables:
        image: <http://myregistry.azurecr.io/prefect-uv:latest|myregistry.azurecr.io/prefect-uv:latest>
        # Critical: do not point to /opt/prefect/entrypoint.sh
        entrypoint: []
        # ACI/infra settings (examples)
        cpu: 2
        memory: "4Gi"
        resource_group_name: my-resource-group
        subscription_id: "00000000-0000-0000-0000-000000000000"
        stream_output: true
        image_registry:
          registry_url: <http://myregistry.azurecr.io|myregistry.azurecr.io>
          username: "{{ prefect.variables.ACR_USERNAME }}"
          password: "{{ prefect.variables.ACR_PASSWORD }}"
        # Optional environment variables for your code
        env:
          UV_HTTP_TIMEOUT: "60"

    # Pull code from GitHub at runtime
    source:
      repo: <https://github.com/org/repo.git>
      branch: main
      access_token: "{{ prefect.variables.GH_TOKEN }}"  # or omit if public
Notes: -
PREFECT_API_URL
and
PREFECT_API_KEY
are automatically injected by the worker at runtime — you do not need to bake them into your image. - Leave
command
unset so the worker can provide the correct flow-run command. Option B — Update the work pool’s base job template (pool-wide default) If your pool was created with a template that sets an entrypoint script, replace it: 1) Export the default:
Copy code
prefect work-pool get-default-base-job-template --type azure-container-instance:push --file aci-template.json
2) Edit
aci-template.json
and set:
Copy code
"entrypoint": []
Ensure
"command": "{{ command }}"
remains. 3) Apply it to your pool (create or overwrite):
Copy code
prefect work-pool create aci-push --type azure-container-instance:push --base-job-template aci-template.json --overwrite
Custom Dockerfile for a UV-based image Make sure Prefect (and any azure integrations you need) are installed in the image; do not set a custom entrypoint — Prefect will supply the run command. ``` # Example UV + Python base FROM ghcr.io/astral-sh/uv:python3.12-bookworm # Optional OS deps your libs need RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* WORKDIR /app # If you use pyproject/uv.lock # Copy only lock files first to leverage Docker layer caching COPY pyproject.toml uv.lock ./
RUN uv pip install --system --frozen . # Or, if you prefer requirements.txt: # COPY requirements.txt . # RUN uv pip install --system -r requirements.txt # Ensure Prefect is in the image along with azure integration RUN uv pip install --system "prefect>=3.0.0" "prefect-azure>=0.4.0" # Do not set ENTRYPOINT; Prefect ACI worker will inject the correct command # CMD is optional; it will be overridden by the worker-provided command ``` Why this works - The ACI worker will inject the correct flow-run
command
into the container. With
entrypoint: []
, ACI will execute that command directly without looking for
/opt/prefect/entrypoint.sh
. - Your image just needs to have Python + Prefect (and your dependencies) available. If you can share your current
prefect.yaml
and the exact error from ACI, I can tailor the
job_variables
(e.g., resource group, registry creds) and verify everything matches your setup.
z
setting entrypoint value in the job_variables value to an empty string worked, entrypoint: "". It now runs the entrypoint python -m prefect.engine