Hagai Arad

10/26/2020, 9:49 AM
Hello 👋 I’ve been trying to find the best way to set my prefect environment totally containerised and can’t manage to do it at the moment. I’m currently trying to use “docker in docker”: I’ve created an image that includes docker, docker-compose and prefect. I create a container of this image and run the prefect commands to initialise prefect server and ui. It all seems to work fine, but when launching localhost:8080 it shows me the home page and asks me to create a tenant. When running the create-tenant command (both in python and cli) from within the docker container I get an error (attached as a reply). When installing prefect on my host machine and running the create-tenant command the ui is working, but this is the exact thing I want to avoid (to install prefect on the host machine). Would love to get any tips how to solve it OR how to design it in another containerised way. Thanks!
The error I get when running from within the container. command:
Copy code
prefect server create-tenant --name default --slug default
Copy code
Traceback (most recent call last):
  File "/usr/local/bin/prefect", line 8, in <module>
  File "/usr/local/lib/python3.8/site-packages/click/", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/click/", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/site-packages/click/", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/prefect/cli/", line 420, in create_tenant
    client = prefect.Client()
  File "/usr/local/lib/python3.8/site-packages/prefect/client/", line 124, in __init__
    tenant_info = self.graphql({"query": {"tenant": {"id"}}})
  File "/usr/local/lib/python3.8/site-packages/prefect/client/", line 275, in graphql
    result = <|>(
  File "/usr/local/lib/python3.8/site-packages/prefect/client/", line 230, in post
    response = self._request(
  File "/usr/local/lib/python3.8/site-packages/prefect/client/", line 400, in _request
    response = self._send_request(
  File "/usr/local/lib/python3.8/site-packages/prefect/client/", line 319, in _send_request
    response = <|>(url, headers=headers, json=params, timeout=30)
  File "/usr/local/lib/python3.8/site-packages/requests/", line 578, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=4200): Max retries exceeded with url: /graphql (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f1ffe4e4af0>: Failed to establish a new connection: [Errno 111] Connection refused'))

Kyle Moon-Wright

10/26/2020, 4:06 PM
Hey @Hagai Arad, I can't speak directly to your traceback here, but I would highly recommend checking out this

Server deployment tutorial

- I think the information there may be useful for setting up Server and troubleshooting that tenant issue.

Hagai Arad

10/27/2020, 6:39 AM
@Kyle Moon-Wright Thanks! That helps a bit understanding my problem, but not solving it 😅