Is there a document describing how to deploy Prefect Orion as a Docker container?

Hi All,

We have the need to deploy Prefect 2.0 Orion as a Docker container. Is there a guide on how to do this?

I have deployed it on an Ubuntu server successfully but am running into issues when trying to deploy as a docker container. Specifically, I cannot see flow runs in the UI.

Dockerfile

FROM ubuntu
WORKDIR /app
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=America/Indiana/Indianapolis
RUN apt-get update; apt-get install curl git vim sqlite3 pip tzdata python3 -y
RUN pip install -U prefect
COPY scripts/startPrefect.sh /app/startPrefect.sh
ADD taskLib /app/taskLib
EXPOSE 4200

startPrefect.sh

#!/bin/bash
prefect config set PREFECT_ORION_UI_API_URL=http://0.0.0.0:4200
prefect config set PREFECT_API_URL=http://0.0.0.0:4200/api
prefect orion start --host 0.0.0.0 &

Kind of :slight_smile: I’m working right now on a recipe to automatically redeploy a containerized agent to AWS ECS any time your Dockerfile or requirements.txt change on push to your repo - I might move it to another repository but here is an already working version under GitHub Actions workflows

And when it comes to deploying Orion as a Docker container purely, it’s much easier if you would use the official Docker image such as e.g.

FROM prefecthq/prefect:2.0.4-python3.9

This way Prefect is already installed

Thanks @anna_geller.

I was able to rebuild my container using the official docker image. However, I still cannot see the Flow Runs in the UI.

Any advice would be appreciated.

Can you describe your approach a bit more? Are you running Orion in the UI? If so, this is how you can start a container:

docker run --platform linux/amd64 -ti -p 4200:4200 --expose=4200 prefecthq/prefect:2.0.4-python3.9

Then within the container, you can start Orion with the UI:

prefect orion start --host 0.0.0.0

Then from the local machine, set a profile to use that Orion instance running in a container:

[profiles.docker]
PREFECT_API_URL = "http://0.0.0.0:4200/api"
PREFECT_LOGGING_LEVEL = "DEBUG"