<@ULVA73B9P> how can I force a deployment pull an ...
# marvin-in-the-wild
m
@Marvin how can I force a deployment pull an image again? the
:latest
tag was updated but the deployment seems to still point to the previous version of the image
m
To force a Prefect deployment to pull the latest version of an image, ensure the following steps: 1. Update the Docker Image: Ensure that the image with the
:latest
tag has been updated in your Docker registry. 2. Recreate the Deployment: This can force the deployment to pull the latest version. Here's an outline of how you might achieve this: ### Steps 1. Update the Docker Image: Update and push the Docker image with the
:latest
tag.
Copy code
bash
   docker build -t my-repo/my-image:latest .
   docker push my-repo/my-image:latest
2. Reconfigure the Deployment: You can use the updated image in your Prefect deployment. Here’s an example of how you might set it up in a
prefect.yaml
file:
Copy code
yaml
   build:
     - prefect_docker.deployments.steps.build_docker_image:
         requires: prefect-docker>=0.3.0
         image_name: my-repo/my-image
         tag: latest
         push: true
Using
{{ image }}
within
prefect.yaml
ensures that you don’t risk having your build step and deployment specification out of sync with hardcoded values. 3. Deploy using Prefect CLI: Deploy the updated settings to force a pull of the new image:
Copy code
bash
   prefect deployment build flow.py:flow_function -n "My Deployment"
   prefect deployment apply my-deployment.yaml
### Example Adjustments in Deployment File: Make sure your deployment YAML (
prefect.yaml
) is pointing correctly:
Copy code
yaml
  build:
    - prefect_docker.deployments.steps.build_docker_image:
        image_name: "my-repo/my-image"
        tag: "latest"
        push: true
  deploy:
    - prefect.deployments.steps.deploy_flow_to_work_pool:
        requires: ["prefect>=2.0"]
        pool_name: "my-work-pool"
        job_variables:
          image: "{{ image }}"
Whenever you reapply the deployment, it should pull the latest image. For further details: - Prefect Docker Integration - Prefect Deploy Guide - Updating Tags in Docker Images Hopefully, this helps you in getting the latest image pulled for your deployments. If issues persist, you might need to debug any caching mechanisms or settings within your deployment environment.