I’m trying to make a docker image that’ll allow me...
# prefect-community
v
I’m trying to make a docker image that’ll allow me to run my flows within it. I attempted to use
prefecthq/prefect:latest
as the base image, but encountered pyscopg2 installation issues, so I decided to just pip install prefect within the image. The example below is super basic (just want to be able to run a
prefect
command). However, when I run the image, I get the following error:
/bin/sh: 1: prefect: not found
I’ve also attempted the following variations in place of the
CMD prefect version
command: •
RUN ["/bin/bash", "-c", "prefect version"]
CMD ["prefect", "version"]
Any ideas? 😄
c
Hi @Viv Ian - I’ll try to recreate; in the meantime could you share the
psycopg2
error you ran into? We use our base images all over the place so I’d be surprised if there was something corrupt in them, but if so we’d want to know ASAP
Hi @Viv Ian I am unable to recreate your issue; building and running a Docker container off the file you included worked well for me and outputted
0.10.2
Are you running on a Windows machine by any chance?
v
Hi Chris, I’m running on a Mac. Apologies for the omission. The
psycopg2
error is raised when attempting to pip install the
django-heroku
package within
requirements.txt
. The error is below:
c
Hi @Viv Ian this error is unrelated to Prefect; if you look closely at the traceback, it suggests you try to install
psycopg2-binary
instead of
psycopg2
, otherwise you’ll need to install
pg_config
into this image
v
Hi @Chris White totes understand this isn’t a prefect error. This was the error I was getting when attempting to use prefect as the base image, so I wanted to go about using a different base image and creating my own Dockerfile. Wasn’t sure if this was something anyone else had run into. 😅
c
ah gotcha gotcha
v
Figured out the issue and posting here in case anyone encounters in the future…just gotta add this line in the Dockerfile before installing whatever needs psycopg2:
RUN apt-get update && apt-get install -y postgresql libpq-dev postgresql-client postgresql-client-common
c
Awesome - I’ll archive this thread to GitHub so anyone else with this issue can find it!
👍 1
@Marvin archive “Issue installing psycopg2 in Prefect Docker image”