After building Docker storage using a custom local...
# prefect-community
After building Docker storage using a custom local Dockerfile for multiple flows a la is it possible to execute a flow in situ locally, running in the container, to closely replicate remote execution?
Do you want to run the flow in the context of a cloud run or a local run inside the container to see if it works?
More clearly: do you want the flow to communicate state with Prefect Cloud for this run or no?
This would be a local run but executing the
within the container to see if it works. In that context, would it still need to connect to Prefect Cloud to get secrets, or would the
Copy code
use_local_secrets = true
and all the configs in my
be honored during this local run?
If the
inside the container contains your secrets then setting
to True would use them otherwise it should be fine grabbing the secrets from cloud if set to false. To run your flow inside that container do something like:
Copy code
from import Docker

flow = Docker().get_flow(flow_location="/root/.prefect/my_flow.prefect")
Copy code
Traceback (most recent call last):
  File "./", line 221, in <module>
  File "./", line 207, in main
  File "/home/luke/.pyenv/versions/kepler/lib/python3.7/site-packages/prefect/environments/storage/", line 214, in get_flow
    with open(flow_location, "rb") as f:
PermissionError: [Errno 13] Permission denied: '/root/.prefect/my_flow.prefect'
How are you running the docker container?
docker run -it my_image
? Looks like in the image you build you don’t have root access
ah, I was assuming that since flow came from the Docker().get_flow,
would run
docker run -it ...
for you. I ran that and stopped getting the PermissionError. Now it seems to be failing to find a variable I added to my local prefect config. I'm not copying a
into the container, so looks like I'll need to figure that out. Thanks for the guidance!