Hi, i want to use docker compose for prefect like ...
# ask-community
a
Hi, i want to use docker compose for prefect like we are using for other services. Is there a way so i can store everything like custom modules and flows in docker image and when i run the docker compose i should be able to access and run the flow using prefect cloud
a
So docker compose helps to build and run multiple dockerized services on a single host. With Prefect flows it's a bit different, because you only need to build the image with Docker and to run it you would use the Prefect backend API rather than docker run. But if you wish to leverage docker compose to build e.g. multiple base images for your flow, then this could work, but not with Docker Storage because docker storage uses it's own build process triggered at flow registration. Docker compose might actually add unnecessary complexity in your flow deployment process but you can try using it to build the base images, especially if you use e.g. GitHub storage
a
https://github.com/flavienbwk/prefect-docker-compose this guy is doing it using server and local Agent
a
If this pattern works for you, give it a try. I don’t see him building docker images there though, he’s only attaching volumes for flows because docker compose is for running things locally on a single host. I think for you it’s different because you want to deploy your flows to GCP, correct? I wouldn’t use docker-compose for that, but if you want to, you can use it only to build base images. Does it answer your question?
a
I dont want to use gcp for now. i need to go with docker compose so once docker compose works i can give it to my supervisor and he can run it locally.
now i need to shift things ( flow on github, custom moudels in docker image on gcr, and agent on gke) to local (to docker compose) so every thing can work locally, for some time.
a
I don’t think this would work. The best you could do would be to build a Docker image and register your flow and send a PR to your supervisor or let him run the flow from the UI to confirm?
a
sorry PR?
a
Pull Request
a
but things work locally for me without docker compose, like for local environment i have custom modules placed on hard drive and on another folder i have flow file and i just run python3 flow.py and it works locally (without using cloud or server) and runs all the tasks in flow
so my not mimic this behaviour for docker compose. Or what i can do is also place the flow file along with custom modules in docker file and when it buids the container we can make it run the command python3 flow.py
a
sure, you can do that. LMK if you have any specific question I can help with
a
ok Thank you!