https://prefect.io logo
n

Niccolò Randazzini

08/28/2023, 10:08 AM
Hi, can anyone help? I am trying to start prefect with docker using the following compose file:
Copy code
version: "3.3"
services:
  database:
    image: postgres:15.2-alpine
    ports:
      - 5432:5432
    volumes:
      - ./postgres:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_DB=prefect

  server:
    image: prefecthq/prefect:2.11.5-python3.11
    restart: always
    volumes:
      - ./prefect:/root/.prefect
    entrypoint: ["/opt/prefect/entrypoint.sh", "prefect", "server", "start"]
    environment:
      # If you want to access Prefect Server from anywhere other than the Docker host machine, you will need to change
      # PREFECT_UI_URL to match the external hostname/IP used to load the  UI in your web browser.
      - PREFECT_UI_URL=<http://127.0.0.1:4200/api>
      - PREFECT_API_URL=<http://127.0.0.1:4200/api>
      - PREFECT_SERVER_API_HOST=0.0.0.0
      - PREFECT_API_DATABASE_CONNECTION_URL=<postgresql+asyncpg://postgres:postgres@database:5432/prefect>
      # Uncomment the following line if you want to use the 'S3 Bucket' storage block instead of the older 'S3' storage
      # - EXTRA_PIP_PACKAGES=prefect-aws
    ports:
      - 4200:4200
    depends_on:
      - database
, but I always get this error:
Copy code
prefect-docker_server_1 exited with code 1
server_1    | Traceback (most recent call last):
server_1    |   File "/usr/local/lib/python3.11/site-packages/prefect/cli/_utilities.py", line 41, in wrapper
server_1    |     return fn(*args, **kwargs)
server_1    |            ^^^^^^^^^^^^^^^^^^^
server_1    |   File "/usr/local/lib/python3.11/site-packages/prefect/utilities/asyncutils.py", line 225, in coroutine_wrapper
server_1    |     global_thread_portal = get_global_loop()
server_1    |                            ^^^^^^^^^^^^^^^^^
server_1    |   File "/usr/local/lib/python3.11/site-packages/prefect/_internal/concurrency/threads.py", line 251, in get_global_loop
server_1    |     GLOBAL_LOOP.start()
server_1    |   File "/usr/local/lib/python3.11/site-packages/prefect/_internal/concurrency/threads.py", line 148, in start
server_1    |     self.thread.start()
server_1    |   File "/usr/local/lib/python3.11/threading.py", line 957, in start
server_1    |     _start_new_thread(self._bootstrap, ())
server_1    | RuntimeError: can't start new thread
server_1    | An exception occurred.
m

morten

08/28/2023, 10:15 AM
Hi, i am not sure if this helps, as it does not directly answer your question, but I use this setup. Maybe you can use it as a starting point and work on it from there.
n

Niccolò Randazzini

08/28/2023, 1:46 PM
I solved it. It was the docker version, probably too old. thanks anyway