https://prefect.io logo
Title
l

Leo Kacenjar

03/28/2022, 9:47 PM
Hi There, I'm wondering exactly how the Prefect Docker Agent calls docker run. I have a
CMD
in my dockerfile and it seems to not be executing. That makes me think it is being overwritten. Maybe I have to provide an
ENTRYPOINT
intead?
k

Kevin Kho

03/28/2022, 9:49 PM
The Docker Agent gets the image you supplied and adds commands on top to
prefect execute flow-run
. I think you want an entrypoint though.
l

Leo Kacenjar

03/28/2022, 9:50 PM
Ok, that makes sense. It would need to pass in flow details. I hadn't thought about that. Thanks!
k

Kevin Kho

03/28/2022, 9:51 PM
Wait what are you trying to do?
l

Leo Kacenjar

03/28/2022, 10:05 PM
I'm trying to make sure a database is started.
Which is proving to be challening.
My dockerfile has a line like:
ENTRYPOINT sudo service mariadb start && bash
And that seems to be causing prefect cloud to hang.
Locally, that ensures the db is running and seems to work. Is there a different way I should tackle that?
Seems like that is usually handled in a
CMD
or
ENTRYPOINT
keyword.
k

Kevin Kho

03/28/2022, 10:33 PM
i believe ENTRYPOINTS should run, but how about if you tried it as a system call inside the Flow?
l

Leo Kacenjar

03/28/2022, 10:34 PM
Ok, I'll give it a shot.
a

Anna Geller

03/29/2022, 10:13 AM
There are many things you should examine: 1. When you run
sudo
, you’re accessing a different Prefect home directory with different settings 2. Your Prefect Dockerfile should ideally use a Prefect base image and keep the entrypoint from there. You should run your maria DB service in a separate container. If you need an example 3. The Docker agent itself should ideally run as a subprocess, rather than a container