https://prefect.io logo
Title
s

Seth Coussens

07/27/2022, 11:38 PM
Anyone have any examples of running a DockerContainer deployment in Prefect 2.0 GA? Non of the documentation is correct that is referenced in the migration guide and even the tutorial I found with the correct code had the wrong CLI commands, and the new commands that would appear to be equivalent ignores the Deployment() function in the script.
āœ… 1
k

Khuyen Tran

07/27/2022, 11:51 PM
Hi Seth, we no longer have the
Deployment()
function and replace it with a deployment manifest and
deployment.yaml
instead. You can find the updated docs about deployment here. Basically, you can run:
prefect deployment build <path-to-your-flow>:<your-flow> -n <deployment-name> -t <tag> -i DockerContainer
to run your flows in a Docker container. We will update the docs for this as soon as possible
ā¤ļø 1
s

Seth Coussens

07/28/2022, 2:04 AM
Thanks for the quick assistance, that does help.
Does this also mean that you no longer support the register + build formula? Just trying to figure out how big of a lift this is going to be for us coming from 1.2 where everything we do is in custom docker images that include our custom packages.
Currently, we do this for storage, but I don't see the equivalent in 2.0. Is this something we are going to need to wait on for a solution?
Flow('attach files', storage=Docker(registry_url="<http://myrepo.azurecr.io/prefect/runsheets|myrepo.azurecr.io/prefect/runsheets>", dockerfile="./.devcontainer/Dockerfile")) as flow:
i

Ilya Galperin

07/28/2022, 6:43 PM
I have a similar question to Seth here. I did notice the packaging class information was removed from the Concepts page recently, is this functionality going to be deprecated or is this still the intended way to build and point to docker images in deplpoyments ala DockerStorage in Prefect 1.0?
k

Khuyen Tran

07/28/2022, 7:31 PM
Using packaging is depreciated. The alternative to packaging is specifying infrastructure in the
prefect deployment build
command. The specific command is:
prefect deployment build <path-to-file>:<flow-name> -n <deployment-name> -i docker-container
šŸ™Œ 1
i

Ilya Galperin

07/28/2022, 10:31 PM
Thank you for clarifying Khuyen!
:marvin: 1
Hi @Khuyen Tran ā€” sorry to bug you about this again ā€” but I am looking over the documentation and am a little confused; if we were to use this docker-container infrastructure flag, does this actually generate an image and place it somewhere and if so, would that the image built would also only be operable from a Docker flowrunner? In our case, we are looking for replacement functionality similar to DockerStorage from 1.0 that allows us to use that image in any runner class i.e. KubernetesRun or
KubernetesJob
in the 2.0 world. To do this, would we instead need to follow the Building your Own Image strategy found here and point to it when configuring our
KubernetesJob
infrastructure? It seems like the packaging module did this before but unless Iā€™m misunderstanding doing
prefect deployment build ... -i docker-container
does not have the same functionality?