'OCI runtime create failed: container_linux.go:380

I am trying to start a container from the given image below but I am getting the following error:

ERROR: for code_challenge_api Cannot start service api: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/app/entrypoint.sh": permission denied: unknown

ERROR: for api Cannot start service api: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/app/entrypoint.sh": permission denied: unknown
ERROR: Encountered errors while bringing up the project. make: *** [Makefile:3: api] Error 1

This is my docker-compose.yml file:

version: "3"
services:
  postgres:
    image: postgres:13.2
    container_name: code_postgres
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=postgres
    command: postgres -c 'max_connections=200'
    ports:
      - "5439:5432"
    networks:
      - localdockernetwork
  api:
    build:
      context: ./api
    container_name: code_api
    volumes:
        - ./api:/app
        - ./api/models:/models
        - ./api/tests:/tests
    ports:
      - "3001:3001"
    networks:
      - localdockernetwork
    depends_on:
      - postgres
    tty: true

networks:
  localdockernetwork:

This is /app/entrypoint.sh file:

#!/bin/bash

set -e

pushd models/migrations
alembic upgrade head
popd

exec gunicorn -b 0.0.0.0:3001 --worker-class gevent app:app "$@"

How can I fix it?



Solution 1:[1]

Before exec, add pip install gunicorn

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 vahbuna