File not found when copy in docker file


I am new in Koyeb and I am trying to deploy a FastApi dockerized application.

I can run it without any problem in my local machine. However, if I try to deploy it in Koyeb, the docker file presents some error during COPY command as it cannot find several files.

I suppose this is related to default build context, but I am not sure if it is the real reason either how to solve it.

My docker file is like follows:

FROM python:3.9-slim


COPY ./requirements.txt /code/requirements.txt

RUN apt-get update && apt-get install -y libgomp1 gcc python3-dev
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt


COPY app /code/app/

CMD uvicorn app.main:app --host --port 8000 --reload

An the error is app.main is not found.

I tried also copying only the two files in my app folder, but the result is the same. Can anyone help me?

Thanks so much for the help.

Hi @Alba_Molera_Chacon!

I noticed you also tried to deploy a Docker image but it failed because it was built for ARM64 while we use linux/amd64


I looked at your koyeb app, and the Dockerfile you were using seems almost ok.

I think on the last build from dockerfile version you were using, you had an error because you launch the server in development mode, in the current directory.

INFO:     Will watch for changes in these directories: ['/']
INFO:     Uvicorn running on (Press CTRL+C to quit)
INFO:     Started reloader process [6] using statreload
ERROR:    Error loading ASGI app. Could not import module "app.main".
Traceback (most recent call last):
  File "/usr/local/bin/uvicorn", line 8, in <module>
  File "/usr/local/lib/python3.9/site-packages/click/", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/uvicorn/", line 426, in main
    run(app, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/uvicorn/", line 447, in run
    ChangeReload(config,, sockets=[sock]).run()
  File "/usr/local/lib/python3.9/site-packages/uvicorn/supervisors/", line 45, in run
    if self.should_restart():
  File "/usr/local/lib/python3.9/site-packages/uvicorn/supervisors/", line 24, in should_restart
    for file in self.iter_py_files():
  File "/usr/local/lib/python3.9/site-packages/uvicorn/supervisors/", line 51, in iter_py_files
    for path in list(reload_dir.rglob("*.py")):
  File "/usr/local/lib/python3.9/", line 1190, in rglob
    for p in selector.select_from(self):
  File "/usr/local/lib/python3.9/", line 611, in _select_from
    for p in successor_select(starting_point, is_dir, exists, scandir):
  File "/usr/local/lib/python3.9/", line 559, in _select_from
    entries = list(scandir_it)
OSError: [Errno 22] Invalid argument: '/proc/8/task/8/net'

The issue is that the process is launched in development mode with the --reload parameter in the / system root directory.

I think you can remove the ‘–reload’ param and it should be working.
If you want to keep the live reload mode, you could change the WORKDIR and make sure your app is only watching the app directory (which is / in your latest version of the dockerfile).

Hope this helps!