'starting container process caused: exec: "uvicorn": executable file not found in $PATH: unknown

I'm trying to Dockerize my FastApi app, but it crash with this error right after I run the command, docker-compose -f local.yml up -d. Some one can help me please?

Dockerfile:

FROM python:3.6.11-alpine3.11
ARG MYSQL_SERVER
ARG POSTGRES_SERVER
ENV ENVTYPE=local
ENV PYTHONUNBUFFERED 1
ENV APP_HOME=/home/app/web
RUN mkdir -p $APP_HOME
WORKDIR $APP_HOME

RUN apk update && apk add --no-cache bash
ADD /compose/scripts.sh $APP_HOME
ADD /requirements/$ENVTYPE.txt $APP_HOME
RUN chmod +x scripts.sh

RUN ./scripts.sh
RUN pip install -r /home/app/web/$ENVTYPE.txt; mkdir /log;

COPY /src/ $APP_HOME
CMD ["uvicorn", "app.main:app", "--reload", "--host", "0.0.0.0", "--port", "8080"]

local.yml file:

version: '3.7'
services:
  nginx:
    env_file: .env
    build: 
      context: .
      dockerfile: ./compose/local/nginx.Dockerfile
    restart: always
    ports:
       - "${EX_PORT_NGINX:-8030}:80"
    volumes:
       - ./nginx/site.conf:/etc/nginx/conf.d/default.conf
  core:
    env_file: .env
    build: 
      context: .
      dockerfile: ./compose/local/core.Dockerfile
      args:
        MYSQL_SERVER: ${MYSQL_SERVER:-}
        POSTGRES_SERVER: ${POSTGRES_SERVER:-}
    restart: always
    volumes:
       - ./src:/home/app/web/
    logging:
       driver: "json-file"
       options:
          max-size: "5m"
          max-file: "10"

ERROR:

Cannot start service core: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "uvicorn": executable file not found in $PATH: unknown



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source