How to configure the pull step for a project building a docker image?

Hello, I’m trying the new project feature, but can’t get the last step to work.

I configured my prefect.yaml to build and push a custom image into a private docker registry. Build is successful, I can see my image in my repository, and it appears in Prefect UI. But when I run it, it fails to find the code to run:

FileNotFoundError: [Errno 2] No such file or directory: '/opt/prefect/flow'

  • prefect.yaml :
name: flow
prefect-version: 2.10.4

build:
- prefect_docker.projects.steps.build_docker_image:
    requires: prefect-docker>0.1.0
    image_name: xxx/orion
    tag: test-1.0
    dockerfile: Dockerfile
    push: True
    credentials: "{{ prefect.blocks.docker-registry-credentials.docker-hub }}"

pull:
- prefect.projects.steps.set_working_directory:
    directory: /opt/prefect/flow

  • deployment.yaml:
# base metadata
name: hello-world-deploy
version: null
tags: []
description: null
schedule: null

# flow-specific fields
#flow_name: check
entrypoint: flow.py:check
path: null
parameters: {}
parameter_openapi_schema: null

# infra-specific fields
work_pool:
  name: my-pool
  work_queue_name: default
  job_variables: {}
  • Dockerfile:
FROM xxx/prefect:base-3.10

COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY ./* /opt/prefect/flow/

From my understanding, the pull step is executed outside of the docker container, as I inspected the image and files are visible. Removing the pull doesn’t seem to be an option either, any help is appreciated :slight_smile:

To anyone finding this thread, I resolved it (thanks Prefect slack community):

In deployment.yaml:

work_pool:
  name: my-work-pool
  job_variables:
    image: ' {{ image_name }} '

As my image wasn’t actually being pulled by the worker.

Also, I use a kubernetes worker and I had to change ImagePullPolicy to always and make sure CLI and docker image were both to latest version :slight_smile: