Zach Khorozian
08/29/2025, 5:13 AMMarvin
08/29/2025, 5:13 AMMarvin
08/29/2025, 5:22 AM/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):
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
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:
prefect work-pool get-default-base-job-template --type azure-container-instance:push --file aci-template.json
2) Edit aci-template.json
and set:
"entrypoint": []
Ensure "command": "{{ command }}"
remains.
3) Apply it to your pool (create or overwrite):
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 ./Marvin
08/29/2025, 5:22 AMcommand
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.Zach Khorozian
08/29/2025, 1:12 PM