<@ULVA73B9P>I have prefect's api and ui running in...
# ask-marvin
c
@MarvinI have prefect's api and ui running in a docker container on my production server. I can create workpools remotely, how can I start these workpools and keep them on in my container?
m
To start and keep your work pools running in a Docker container, you'll need to manage the worker processes that poll the Prefect API for scheduled flow runs. Here's a concise guide: 1. Start a Worker: Workers are lightweight processes that check for scheduled flow runs and execute them. You can start a worker with a command like:
Copy code
bash
   prefect worker start --pool my-docker-pool
Ensure that your Docker container has Prefect installed and configured to communicate with your Prefect API. 2. Daemonize the Worker: In a production environment, you should run the worker as a daemonized or managed process. This can be done using Docker's capabilities to keep processes running. For example, you might use a Dockerfile with a command like:
Copy code
dockerfile
   CMD ["prefect", "worker", "start", "--pool", "my-docker-pool"]
This ensures that the worker process continues to run and poll for jobs, even if you disconnect from the terminal. 3. Verify in Prefect UI: You can verify the status of your work pool and worker in the Prefect UI. Navigate to the Work Pools tab to ensure that your pool is listed and that the worker is active. For more details, you can refer to the Prefect documentation on Docker infrastructure and work pools.
c
I see, I guess in my case best practice would be to add another docker container to my docker compose for each work pool. For example, I run a container for the workpool I already have going.