0

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?

  • Perhaps a duplicate to https://stackoverflow.com/questions/38882654/docker-entrypoint-running-bash-script-gets-permission-denied ? – Markus Apr 23 '22 at 20:56

1 Answers1

0

Before exec, add pip install gunicorn

vahbuna
  • 31
  • 3