https://prefect.io logo
Title
d

Dalin Stone

12/29/2022, 4:20 PM
Hi Team! 👋 Is it possible to have a custom docker image in your local file system be referenced by the docker-container infrastructure block when building a deployment or am I required to have my custom docker image on Docker Hub/Docker Registry and access it through those systems?
✅ 1
a

Anna Geller

12/29/2022, 4:44 PM
yes it is, you would need to set the image pull policy to Never, then Prefect will only look for images available locally
🙌 2
d

Dalin Stone

12/29/2022, 5:27 PM
You're the best Anna! 🥂
😄 1
@Anna Geller How can I pass the '-p {host_port}:{container_port}' option to the docker infrastructure block to properly map ports? When I try to connect to a external/remote mysql server instance from my code, I receive error '2002, can't connect to mysql server {my_server}, 115' when running the deployment. I think this is because my container doesn't have the properly mapped ports to connect to an external/remote mysql server. None of the documentation mentions how to pass the -p port argument
a

Anna Geller

12/30/2022, 12:58 AM
what's your setup? are you on Prefect Cloud or self-hosting? if you're self-hosting or just exploring things locally with docker, check out this docker compose setup https://discourse.prefect.io/t/running-prefect-2-with-docker-compose/1516
✅ 1
d

Dalin Stone

12/30/2022, 3:12 PM
@Anna Geller We are using Prefect Cloud, is it possible to pass that -p in the docker container infrastructure block or is there another way we could map ports for the container?
This works great, thank you Anna! 🥂
🙌 1