Hi <@ULVA73B9P>, I am facing a problem where I am ...
# ask-marvin
g
Hi @Marvin, I am facing a problem where I am trying to run my deployments in docker containers, and the flows are stuck in
Downloading flow code from storage at '.'
. There is no other error output as far as I can see, neither from the server nor from the workers what could be the reason?
m
thought for 461.2 seconds
Short version: that log means the run is trying to pull your flow code to the container and can’t finish. In Docker, the usual culprits are misconfigured storage, missing git/credentials, or syncing a gigantic directory. Most common causes and fixes (Prefect 3.x): 1) Local storage set to “.” inside a container - Symptom: Logs say “Downloading flow code from storage at '.'” and it sits there. - Why: Your deployment’s storage is LocalFileSystem with base “.”. Inside a Docker run container, “.” is just the working dir, so Prefect tries to copy the whole project onto itself. If the project is large or contains symlinks, this can be slow or hang. - Fix options: - Bake code into your image and don’t use storage at all. - Example (Python API):
Copy code
from prefect import flow
      from prefect.docker import DockerImage

      @flow
      def my_flow(): ...

      my_flow.deploy(
          name="my-deployment",
          work_pool_name="docker-pool",
          image=DockerImage(name="your-repo/prefect-flows:latest"),
          build=True,
          push=True,  # bake the code into the image
      )
- Or via CLI, run
prefect deploy
from your project using a Docker work pool so the build step copies the project into the image. - Or fetch code at runtime from a repo instead of “.”:
Copy code
from prefect import Flow

    Flow.from_source(
        "<https://github.com/your-org/your-repo.git>",
        entrypoint="flows/etl.py:etl",
    ).deploy(name="etl", work_pool_name="docker-pool")
- If you must keep LocalFileSystem, ensure the container has the project directory mounted at the same path and you aren’t copying a massive tree. Docs: Store flow code, Docker deployments 2) Missing git in the image - Symptom: Using Flow.from_source(...) with a Git URL, but the container never finishes “downloading”. - Fix: Install git in your image: - Debian/Ubuntu:
Copy code
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
- Alpine:
Copy code
RUN apk add --no-cache git
3) Private repo with no credentials or SSH host key prompts - Symptom: Git “hangs” waiting for credentials/host verification; logs don’t show much. - Fix: - Use HTTPS with a token (prefer passing credentials securely, not in the URL), or configure SSH properly (keys + known_hosts). - For HTTPS tokens, see Prefect’s GitHub integration: https://docs-3.prefect.io/integrations/prefect-github/ - If using SSH, add known host in the image to avoid interactive prompts:
Copy code
RUN mkdir -p /root/.ssh && ssh-keyscan <http://github.com|github.com> >> /root/.ssh/known_hosts
4) You’re syncing way too much code - Symptom: It “hangs” because Prefect is copying a huge directory (node_modules, data dumps, etc.). - Fix: Use a .prefectignore to exclude large/unnecessary paths. - Docs: https://docs-3.prefect.io/v3/how-to-guides/deployments/store-flow-code#project-files-to-include 5) Symlink nightmares - Symptom: Copy step loops or chokes on symlinks, especially when copying “.” to “.”. - Fix: Avoid symlinks into large external dirs; exclude them with .prefectignore or switch to baking code into the image or pulling from Git. Quick diagnostics - Inspect the deployment to see storage/source:
Copy code
prefect deployment inspect "your-flow/your-deployment"
If you see LocalFileSystem with path “.”, that’s your smoking gun. - Turn up logs in the container:
Copy code
PREFECT_LOGGING_LEVEL=DEBUG
- If using from_source, exec into the container and try
git clone
manually to confirm git and auth. If you can share: - Prefect version - How you created the deployment (CLI vs. Flow.from_source, any code or command you used) - The output of
prefect deployment inspect "flow/deployment"
- What base image you’re using (and whether git is installed)
I can point at the exact fix instead of waving my robot arms around.