Anyone have any examples of running a DockerContai...
# prefect-community
s
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
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:
Copy code
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
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?
Copy code
Flow('attach files', storage=Docker(registry_url="<http://myrepo.azurecr.io/prefect/runsheets|myrepo.azurecr.io/prefect/runsheets>", dockerfile="./.devcontainer/Dockerfile")) as flow:
i
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
Using packaging is depreciated. The alternative to packaging is specifying infrastructure in the
prefect deployment build
command. The specific command is:
Copy code
prefect deployment build <path-to-file>:<flow-name> -n <deployment-name> -i docker-container
šŸ™Œ 1
i
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?