https://prefect.io logo
n

Nil

07/11/2023, 2:27 PM
Hey, I am trying to run my workflow with prefect in docker. The package is added in the requirements.txt and I have also added the following lines
RUN mkdir /.prefect  && chown -R random_program_planner /.prefect
USER random_program_planner
However I get the following error when I try to trigger the workflow from docker
/usr/local/lib/python3.9/site-packages/prefect/context.py:505: UserWarning: Failed to create the Prefect home directory at /home/random_program_planner/.prefect
Any help is appreciated 🙂 Thanks
n

Nate

07/11/2023, 2:40 PM
hi @Nil - I wouldn't think that you'd need to make the
.prefect
directory yourself can you share more about how you're building your deployment? your
prefect.yaml
or whatever you're using?
n

Nil

07/11/2023, 2:47 PM
Let me explain. Right now we have our etl workflow with prefect running locally. I can trigger the ETL code, tasks run concurrently with prefect and I can visualize everything in the Prefect UI. Now this needs to run in AWS. We already trigger the ETL code from a step function and would like to keep the same with prefect. So we just added the prefect package in the dockerfile and wanted it to trigger it like before. This is where we get the error
Dockerfile
FROM python:3.9
WORKDIR /tmp/dist
COPY dist/requirements.txt .
RUN pip install -r requirements.txt
COPY dist/boost-0.1.0-py3-none-any.whl .
RUN pip install boost-0.1.0-py3-none-any.whl
WORKDIR /app
COPY resources ./resources
RUN useradd random_program_planner
RUN mkdir .soda/ && chown -R random_program_planner .soda/
RUN mkdir /.prefect  && chown -R random_program_planner /.prefect
USER random_program_planner
ENTRYPOINT ["python"]
CMD ["-m",  "boost"]
n

Nate

07/11/2023, 2:54 PM
hmm, if im understanding your situation (which I might not be), instead of this
Copy code
RUN mkdir /.prefect  && chown -R random_program_planner /.prefect
would you want this?
Copy code
RUN mkdir -p /home/random_program_planner/.prefect && chown -R random_program_planner /home/random_program_planner/.prefect
assuming your
random_program_planner
user is actually
/home/random_program_planner
n

Nil

07/11/2023, 2:57 PM
Let me try this
2 Views