<@ULVA73B9P> When using the docker work pool how d...
# ask-marvin
d
@Marvin When using the docker work pool how do I automatically clean up old containers if I delete the failed or completed flow run in prefect ?
m
Unfortunately, after searching both the Prefect documentation and the GitHub issues, I couldn't find specific guidance on automatically cleaning up old Docker containers after deleting failed or completed flow runs in Prefect using a docker work pool. For general management of Docker containers, you could consider implementing a process outside of Prefect that monitors and cleans up containers based on their status. If they are no longer needed, such a process could run a command like
docker container prune
to remove stopped containers or
docker system prune
to clean up all unused containers, networks, and images. However, if Prefect does offer a built-in solution for this problem, it isn’t clearly documented or discussed in the GitHub issues I encountered, which suggests that this might not be a common feature. To explore further or to get support on this specific issue with Prefect, I recommend reaching out to the Prefect community or checking the documentation directly, particularly the sections on Work Pools and Docker Worker, for any updates or strategies other users have employed for container cleanup.