<@ULVA73B9P> how do i modify this prefect.yaml if ...
# ask-marvin
j
@Marvin how do i modify this prefect.yaml if I want a different docker image to run on my ECS pushpool instead of the default image defined in that workpool? deployments: - name: echo_raw_data_harvest_4vcpu_30gb version: tags: [] description: entrypoint: rca_echo_tools/harvest.py:echo_raw_data_harvest parameters: {} work_pool: name: hydrophone-pool work_queue_name: job_variables: {} schedule: is_schedule_active:
m
thought for 156.4 seconds
Assuming Prefect 3.x: override the image at the deployment level by setting
work_pool.job_variables.image
in your prefect.yaml. That value will override the pool’s default/task definition image for this deployment. Here’s your file with the minimal change:
Copy code
deployments:
- name: echo_raw_data_harvest_4vcpu_30gb
  version:
  tags: []
  description:
  entrypoint: rca_echo_tools/harvest.py:echo_raw_data_harvest
  parameters: {}
  work_pool:
    name: hydrophone-pool
    work_queue_name:
    job_variables:
      image: "<http://123456789012.dkr.ecr.us-east-1.amazonaws.com/your-repo:your-tag|123456789012.dkr.ecr.us-east-1.amazonaws.com/your-repo:your-tag>"
  schedule:
  is_schedule_active:
Optional: if you’re building/pushing an image in the same prefect.yaml with Docker steps, you can reference the built image dynamically:
Copy code
build:
  - prefect_docker.deployments.steps.build_docker_image:
      id: build_image
      image_name: <http://123456789012.dkr.ecr.us-east-1.amazonaws.com/your-repo|123456789012.dkr.ecr.us-east-1.amazonaws.com/your-repo>
      tag: your-tag

push:
  - prefect_docker.deployments.steps.push_docker_image:
      image_name: "{{ build_image.image_name }}"
      tag: "{{ build_image.tag }}"

deployments:
- name: echo_raw_data_harvest_4vcpu_30gb
  entrypoint: rca_echo_tools/harvest.py:echo_raw_data_harvest
  work_pool:
    name: hydrophone-pool
    job_variables:
      image: "{{ build_image.image }}"
Reference: ECS worker source (see
ECSVariables.image
) If you also need to override CPU/memory for this deployment, add them alongside `image`:
Copy code
job_variables:
  image: "..."
  cpu: 4096
  memory: 30720
j
@Marvin so for a simple pull of the latest dockerhub image: deployments: - name: echo_raw_data_harvest_4vcpu_30gb version: tags: [] description: entrypoint: rca_echo_tools/harvest.py:echo_raw_data_harvest parameters: {} work_pool: name: hydrophone-pool work_queue_name: job_variables: image: "jdduprey/rca-echo-tools:latest" schedule: is_schedule_active:
m
thought for 160.6 seconds
Yep—that’s all you need. Setting
work_pool.job_variables.image
will override the ECS work pool’s default image for this deployment and pull
jdduprey/rca-echo-tools:latest
from Docker Hub. Notes: - If your pool’s task definition uses a container name other than the default
prefect
, also set:
Copy code
job_variables:
    container_name: "<your-container-name>"
    image: "jdduprey/rca-echo-tools:latest"
- If the image is private, configure pull credentials via the task definition’s
repositoryCredentials
or ensure your execution role can pull from your registry. - If you want to match your deployment name (4 vCPU / 30 GB), you can also override:
Copy code
job_variables:
    cpu: 4096
    memory: 30720
Source for the
image
override behavior: ECS worker (ECSVariables.image)