jpuris
02/06/2023, 12:43 PM0 * * * * docker compose -f /some/path/docker-compose.yml run --rm my_service my_command
the docker-compose.yml
version: '3.8'
services:
my_service:
build: app/.
env_file:
- app/.env
logging:
driver: journald
How can I tell prefect to create a deployment to
• run a container with a pre-defined image (I want to build it separately.. the docker-compose currently takes care of that)
• load .env file into the container's envs
• run specified my_cmd
(entry-point's args)
All I really need is some sort of reference material of building such deployment 🤷Timo Vink
02/06/2023, 3:36 PMjpuris
02/06/2023, 3:48 PMprefect_docker
lib or I'm mis-using it..
The problem is that the library is sort of useless as it does not wait until the container ("task") completes or exits on it's own.. More info in How do we wait for container to exit on its own? #33
Also Their example does not do what it is trying to convey at all, for example the command="echo 'hello world!' && sleep 60"
will simply output
21:37:54.109 | INFO | Flow run 'glorious-jerboa' - hello world! && sleep 60
and not print "Hello World!" in the logs and then sleep for 60 seconds.. 🤷
--
How do you guys run "containers" as prefect tasks? Seems like it should be trivial thing to do for an orchestration tool and I'm at loss.. 😞Andrew Huang
02/07/2023, 12:41 AMAlso Their example does not do what it is trying to convey at all, for example thewill simply outputcommand="echo 'hello world!' && sleep 60"
21:37:54.109 | INFO | Flow run 'glorious-jerboa' - hello world! && sleep 60
other than not sleeping properly, it did echo “hello world” as a log statement. to get both of the commands working properly, you can put dump it into a shell script like and run bash test.sh
jpuris
02/12/2023, 10:31 AM