<@ULVA73B9P> (venv) mip@LAPTOP-8TUE4PUV:~/ds_pipe...
# ask-marvin
m
@Marvin (venv) mip@LAPTOP-8TUE4PUV:~/ds_pipelines$ prefect config set PREFECT_API_AUTH_STRING="admin:pass" Set 'PREFECT_API_AUTH_STRING' to 'admin:pass'. Updated profile 'ephemeral'. (venv) mip@LAPTOP-8TUE4PUV:~/ds_pipelines$ prefect config set PREFECT_SERVER_API_AUTH_STRING="admin:pass" Set 'PREFECT_SERVER_API_AUTH_STRING' to 'admin:pass'. mip@LAPTOP-8TUE4PUV:~/ds_pipelines/src$ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock --network="host" -e "PREFECT_API_URL=http://localhost:4200/api" -e "PREFECT_API_KEY=admin:pass" prefect-worker-image prefect worker start -p my-docker-pool-2 --type docker Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 101, in map_httpcore_exceptions yield File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 394, in handle_async_request resp = await self._pool.handle_async_request(req) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 256, in handle_async_request raise exc from None File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 236, in handle_async_request response = await connection.handle_async_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection.py", line 101, in handle_async_request raise exc File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection.py", line 78, in handle_async_request stream = await self._connect(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection.py", line 124, in _connect stream = await self._network_backend.connect_tcp(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpcore/_backends/auto.py", line 31, in connect_tcp return await self._backend.connect_tcp( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpcore/_backends/anyio.py", line 113, in connect_tcp with map_exceptions(exc_map): ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit self.gen.throw(value) File "/usr/local/lib/python3.12/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions raise to_exc(exc) from exc httpcore.ConnectError: All connection attempts failed The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/prefect/cli/_utilities.py", line 44, in wrapper return fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/cli/_types.py", line 156, in sync_fn return asyncio.run(async_fn(*args, **kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/cli/worker.py", line 115, in start is_paused = await _check_work_pool_paused(work_pool_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/cli/worker.py", line 180, in _check_work_pool_paused work_pool = await client.read_work_pool(work_pool_name=work_pool_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/client/orchestration/_work_pools/client.py", line 419, in read_work_pool response = await self.request( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/client/orchestration/base.py", line 53, in request return await self._client.send(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/client/base.py", line 348, in send response = await self._send_with_retry( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/client/base.py", line 268, in _send_with_retry response = await send(request, *send_args, **send_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1629, in send response = await self._send_handling_auth( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1657, in _send_handling_auth response = await self._send_handling_redirects( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1694, in _send_handling_redirects response = await self._send_single_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1730, in _send_single_request response = await transport.handle_async_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 393, in handle_async_request with map_httpcore_exceptions(): ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit self.gen.throw(value) File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 118, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ConnectError: All connection attempts failed An exception occurred. prefect server is self hostted in the same pc help me to resilve this
m
thought for 259.3 seconds
Thanks for the details — this error is almost certainly a connectivity/config mismatch between your Dockerized worker and your self‑hosted Prefect Server. There are three common issues in your command: 1) You used PREFECT_API_KEY (Cloud) instead of PREFECT_API_AUTH_STRING (Server) - For self‑hosted Prefect Server, use Basic Auth via
PREFECT_API_AUTH_STRING=admin:pass
. -
PREFECT_API_KEY
is only for Prefect Cloud and won’t work here. - Docs: Server auth settings and API keys vs. basic auth. 2) The URL has angle brackets in it - Your environment var includes
<http://localhost:4200/api>
. The angle brackets will be treated as literal characters and break the URL. Use a plain URL with no brackets. 3) localhost vs container networking - On Linux with
--network host
,
localhost
resolves to the host. On Docker Desktop (Windows/Mac/WSL2),
--network host
does not behave the same and
localhost
inside the container won’t reach services on the host. Use
host.docker.internal
instead. Try these fixes A) First confirm the server is actually reachable from your host:
Copy code
curl -i <http://localhost:4200/api/health>
You should get a 200 OK. B) Then confirm the server is reachable from a container: - On Windows/Mac/WSL2 (Docker Desktop):
Copy code
docker run --rm curlimages/curl <http://host.docker.internal:4200/api/health>
- On Linux (not Docker Desktop), if you use host networking:
Copy code
docker run --rm --network host curlimages/curl <http://127.0.0.1:4200/api/health>
C) Start your worker with the correct env vars and the right host value - Windows/Mac/WSL2 (Docker Desktop):
Copy code
docker run --rm \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -e PREFECT_API_URL=<http://host.docker.internal:4200/api> \
  -e PREFECT_API_AUTH_STRING=admin:pass \
  prefect-worker-image \
  prefect worker start -p my-docker-pool-2 --type docker
- Linux (native Docker, host networking):
Copy code
docker run --rm \
  --network host \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -e PREFECT_API_URL=<http://127.0.0.1:4200/api> \
  -e PREFECT_API_AUTH_STRING=admin:pass \
  prefect-worker-image \
  prefect worker start -p my-docker-pool-2 --type docker
Other checks - Make sure the work pool exists and is of type docker. From a shell that can reach your server:
Copy code
prefect work-pool ls
# or if needed:
prefect work-pool create my-docker-pool-2 --type docker
- Ensure the server was started with auth enabled and is using the same
admin:pass
. If you started the server in a different environment (e.g., another container), you must pass
PREFECT_SERVER_API_AUTH_STRING=admin:pass
to that process as well. - Health check endpoint for the API is
/api/health
. Docs: Self-hosted server. If it still fails, please share: - Your OS (Windows/Mac/Linux) and whether you’re using Docker Desktop or native Docker - How you started the Prefect Server - Output of: -
curl -i <http://localhost:4200/api/health>
on the host - The
docker run curlimages/curl .../health
test from above We’ll get it sorted quickly from there.