Hi all, when deploying flows via dockerfile, prefe...
# ask-community
r
Hi all, when deploying flows via dockerfile, prefect seems to create a large number of images and containers locally. Is there documentation on how to best configure the docker deployment to avoid that behavior?
n
You can let the Prefect worker know that it should remove the container after your flow finishes. You can also configure it to not pull the images if they are already present according to the docker daemon running on the target machine. This is how you would do that using a
prefect.yaml
file.
Copy code
deployments:
  - name: "hello-world"
    version: "0.0.0"
    description: "Hey there"
    entrypoint: "entrypoint"
    work_pool:
      name: "docker-work-pool"
      work_queue_name: "default"
      job_variables:
        image: "<image-url>"
        image_pull_policy: "IfNotPresent"
        auto_remove: true
The key configuration properties here are
auto_remove: true
and
image_pull_policy: IfNotPresent
r
Thanks for the quick response! but aren't those configs for the worker the docker flow is run in?
What I meant is that when I deploy a docker deployment from my mac, it creates a new docker image and pushes it to the docker registry, instead of reusing an old one