<@ULVA73B9P> I have [“/mount/efs/.prefect/storage/...
# ask-marvin
a
@Marvin I have [“/mount/efs/.prefect/storage//root/.prefect/storage/rw”] as a Volumes setting for a Docker-based work pool, and docker inspect shows, that the volume is set correctly. However, data in /mount/efs/.prefect/storage/ is not accessible from the container. Moreover, it seems, that there is some persistency between different runs on this work-pool, but now new cache files added to /mount/efs/.prefect/storage/
m
thought for 565.6 seconds
Thanks for the details — a few common gotchas can cause exactly what you’re seeing. The most likely root cause - Docker work pool “host” paths are resolved on the Docker host where the worker launches containers — not inside the worker container. If your Prefect worker is itself running in a container and your EFS is mounted only inside that worker container (e.g., at
/mount/efs/...
), the flow-run containers will not see it. Docker will try to bind-mount
/mount/efs/...
from the actual host; if that path doesn’t exist there, Docker just creates an empty directory on the host and mounts that. That matches your symptoms: you see persistence between runs (the host dir keeps the data) but not the EFS content or new files you add. How to confirm quickly - On the Docker host (not inside the worker container):
Copy code
ls -ld /mount/efs/.prefect/storage
If that path does not exist or is empty on the host, that’s the issue. Other common causes to check - User/home mismatch: The path you mounted is
/root/.prefect/storage
, but if your image runs as a non-root user (e.g.,
prefect
), Prefect’s home will be
/home/prefect/.prefect
. In that case, the mount won’t line up. Inside a flow-run container, check:
Copy code
whoami
  echo "$HOME"
  prefect settings view | grep PREFECT_HOME
- SELinux: On SELinux-enabled hosts (RHEL/CentOS/Fedora), bind mounts to NFS/EFS often need relabeling. Add
:z
or
:Z
to your volume string:
Copy code
/mount/efs/.prefect/storage:/root/.prefect/storage:rw,z
- Permissions/UID/GID: EFS enforces POSIX permissions and may root-squash; ensure the UID/GID running in the container has read/write perms on the EFS path on the host. Recommended fixes - If your worker runs in a container: - Mount EFS on the Docker host itself at the same path (easiest), then keep your pool volume as:
Copy code
/mount/efs/.prefect/storage:/root/.prefect/storage:rw,z
- Or change the volume source to a host path that does exist and points to your EFS mount. - Ensure you’re mounting to the path Prefect actually uses in your flow-run containers: - Option A: Set
PREFECT_HOME
in the work pool “Env” so it matches your mount:
Copy code
PREFECT_HOME=/root/.prefect
- Option B: If running as a non-root user, mount to
/home/prefect/.prefect/storage
instead. - Make the result storage explicit in your deployment so there’s no ambiguity:
Copy code
from prefect.filesystems import LocalFileSystem

  storage = LocalFileSystem(basepath="/data/prefect-storage")

  app = flow.from_source("<https://github.com/your/repo>")
  app.deploy(
      name="my-deploy",
      work_pool_name="your-docker-pool",
      image="your/image:tag",
      result_storage=storage,
  )
Then mount your EFS to
/data/prefect-storage
in the pool volumes:
Copy code
/mount/efs/.prefect/storage:/data/prefect-storage:rw,z
Helpful debugging trick - Temporarily keep the container around so you can exec in and inspect mounts: - In your Docker work pool’s base job template set
auto_remove
to
false
and (for a test run) override the command to:
Copy code
sleep 600
- Then:
Copy code
docker exec -it <container_id> sh
    mount | grep prefect
    ls -l /root/.prefect/storage
    prefect settings view | grep PREFECT_HOME
If you can share: - Whether the worker is running on the host or inside a container - The image you’re using and which user it runs as - Whether the Docker host uses SELinux - The “Mounts” section from
docker inspect
of a flow-run container …I can give you an exact, minimal set of changes to make this work. For reference on customizing the Docker work pool job template, see: - Prefect 3.x Docker guidance (general Docker setup; job template is edited via the work pool) - You can also view the default Docker job template structure with:
Copy code
prefect work-pool get-default-base-job-template --type docker