<@ULVA73B9P> can you show me how to run a locally ...
# ask-marvin
s
@Marvin can you show me how to run a locally hosted prefect server and agent (Prefect 2.14.14) in a docker container?
m
Prefect has transitioned from using agents to workers with the newer releases, meaning that my advice to use agents won't be useful for you. Instead, I will guide you on how to run a locally hosted Prefect server and a worker using Docker. Let me gather the most current information from the Prefect documentation. I will search for relevant information on running a Prefect server and worker (instead of the deprecated agent) using Docker. Here are the steps to run a locally hosted Prefect server and worker (Prefect 2.14.14) using Docker: ### Running Prefect Server in Docker 1. Start a PostgreSQL Database (Required by Prefect server):
Copy code
bash
    docker run -d --name prefect-postgres -v prefectdb:/var/lib/postgresql/data -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=yourTopSecretPassword -e POSTGRES_DB=prefect postgres:latest
2. Set up and Run Prefect Server: First, configure the Prefect API URL:
Copy code
bash
    prefect config set PREFECT_API_URL="<http://127.0.0.1:4200/api>"
Then, you can start the server with:
Copy code
bash
    docker run -d --name prefect-server -p 4200:4200 prefecthq/prefect:2.14.14
### Running Prefect Worker in Docker 1. Set Up and Run Prefect Worker: First, set up a work pool in your UI if you haven't already:
Copy code
bash
    prefect work-pool create my-docker-pool
Then, start a worker referencing that pool:
Copy code
bash
    docker run -d --name prefect-worker prefecthq/prefect:2.14.14 prefect worker start --pool my-docker-pool
Note: Don't forget to verify the connections and ensure you can see the work pool in your Prefect UI. For more detailed references, you can check: - Running Prefect Server - Running Prefect Workers Does this help you get started?