https://prefect.io logo
Title
a

Anthony Finocchiaro

05/17/2023, 6:18 PM
Hi all, I am trying to run my Prefect Agent using a Rancher container. This is set to pull from the image I pushed to my Azure CR, and I think it is pulling the image correctly since it is able to set the Prefect_API_URL which is set in the dockerfile, and it tries to run a flow when I hit execute on the orchestrator portal. However, I am getting an error that says something where it is unable to connect to Docker. I'm not sure what this means exactly.. I am trying to determine what is missing in my setup, it seems like something isn't installed or something, but this is really hard for me to understand what is off. At some point it does say file not found, so maybe it doesn't have the right version of Python or something? See attached for the error logs. Does anyone know what this is saying?
n

Nate

05/18/2023, 3:06 AM
hi @Anthony Finocchiaro - it looks like docker may not be running where prefect is attempting to run the flow as a container (i assume you're using a Prefect Agent that is trying to run a deployment with
DockerContainer
infrastructure) these parts of trace show the docker client attempting and failing to connect to the docker daemon socket, which usually means docker is not running or its misconfigured somehow
5/15/2023 4:19:08 PM  File "/usr/local/lib/python3.10/site-packages/docker/transport/unixconn.py", line 30, in connect
5/15/2023 4:19:08 PM    sock.connect(self.unix_socket)
5/15/2023 4:19:08 PMurllib3.exceptions.ProtocolError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
5/15/2023 4:19:08 PM  File "/usr/local/lib/python3.10/site-packages/prefect/infrastructure/docker.py", line 67, in _login
5/15/2023 4:19:08 PM    client = self._get_docker_client()
5/15/2023 4:19:08 PM  File "/usr/local/lib/python3.10/site-packages/prefect/infrastructure/docker.py", line 95, in _get_docker_client
5/15/2023 4:19:08 PM    raise RuntimeError("Could not connect to Docker.") from exc
5/15/2023 4:19:08 PMRuntimeError: Could not connect to Docker.
a

Anthony Finocchiaro

05/18/2023, 4:29 PM
Ok, I think that makes sense, do you know how I can make sure docker is running? Is this anything related to the infrastructure block, or is this something elsewhere that needs to be set?
Adding @Joseph Loss
n

Nate

05/18/2023, 4:46 PM
where is your agent running? i see you said
I am trying to run my Prefect Agent using a Rancher container.
but im not sure if you mean the agent itself is running in this container or if its submitting containerized flow runs the easiest way to check whether docker is running is to exec into the place where the agent is running and do
docker pull hello-world
a

Anthony Finocchiaro

05/18/2023, 8:49 PM
The agent itself is running in this container, it is also submitting flow runs in the container that it's running in of course. Right, when I exec into the Rancher container and try to do anything with a docker command, it returns that it doesn't recognize docker as a command. That's why I was thinking docker needed to be installed, but it seems to be able to run the dockerfile because it needs to do that in the first place to run the agent.. So wouldn't that mean that docker has to be installed for it to run? That's what was confusing to me..
Do you know how I can make sure docker is installed in the Rancher container?
I think we were able make sure docker is installed on the Rancher container, but running into a separate issue that I think our Devops team needs to handle, thank you
n

Nate

05/18/2023, 9:48 PM
ok! let me know if we can help with anything else