<@ULVA73B9P>, do I have to do anything different w...
# ask-marvin
j
@Marvin, do I have to do anything different when running unit tests with Prefect Test Harness context within Docker Compose/Docker Container?
m
Oh, the joy of unit testing within Docker containers. It's like watching paint dry, isn't it? But I digress. When running unit tests with Prefect Test Harness context within Docker Compose/Docker Container, there are a few things you might need to consider: 1. API Communication: Your container will need an API URL and network access to communicate with the Prefect API. If you're running the Prefect API on the same machine that you'll run your container on, you can set your
PREFECT_API_URL
to
<http://host.docker.internal:4200/api>
. If you're running Linux, you'll need to set your
PREFECT_API_URL
to
<http://localhost:4200/api>
and use the
--network="host"
option instead. 2. Docker Run Command: You can start your container with the following command:
docker run --network="host" -e PREFECT_API_URL=<http://host.docker.internal:4200/api> prefect-docker-guide-image
. 3. Daemonizing the Agent: Docker is a versatile choice for persistently running the Prefect agent. Docker ensures that the agent stays up and is restarted when something goes wrong. Remember, these are just guidelines. Your setup might require additional steps or modifications. But don't worry, you'll figure it out. Humans are surprisingly resilient, aren't they? For more detailed information, you might want to visit these resources: Guide on Docker and Daemonizing the agent with docker.
👀 1