https://prefect.io logo
h

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
error:
Copy code
Traceback (most recent call last):
  File "/usr/local/bin/prefect", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/prefect/cli/server.py", line 420, in create_tenant
    client = prefect.Client()
  File "/usr/local/lib/python3.8/site-packages/prefect/client/client.py", line 124, in __init__
    tenant_info = self.graphql({"query": {"tenant": {"id"}}})
  File "/usr/local/lib/python3.8/site-packages/prefect/client/client.py", line 275, in graphql
    result = <http://self.post|self.post>(
  File "/usr/local/lib/python3.8/site-packages/prefect/client/client.py", line 230, in post
    response = self._request(
  File "/usr/local/lib/python3.8/site-packages/prefect/client/client.py", line 400, in _request
    response = self._send_request(
  File "/usr/local/lib/python3.8/site-packages/prefect/client/client.py", line 319, in _send_request
    response = <http://session.post|session.post>(url, headers=headers, json=params, timeout=30)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 578, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", 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'))
k

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.
h

Hagai Arad

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