hasan bilal
hasan bilal

Reputation: 37

error while running entrypoint.sh file in docker-compose

I am trying to dockerize my Flask application with Postgres database. I have an entrypoint.sh file that runs the migration files to create the tables and start the Supervisor monitor and control of the web server.

This is the code:

flask db upgrade

supervisord -c /config/supervisord.conf

and here is the ENTRYPOINT command in the Dockerfile:

ENTRYPOINT [ "./entrypoint.sh" ]

and in the docker-compose.yml file:

server:

container_name: server
restart: always
build: ./server
image: flask_app:v0.30
depends_on:
  - db
ports:
  - "5000:5000"
volumes:
  - ./server:/app
networks:
  - backend
entrypoint: ./entrypoint.sh

but when I ran the docker-compose up command I got:

exec ./entrypoint.sh: exec format error

I've read that the problem happened because the image has been created in architecture but it is using a different architecture, but I couldn't found what is the solve of this problem. So, what how can I solve this problem.

Upvotes: 0

Views: 822

Answers (1)

Matteo Zanoni
Matteo Zanoni

Reputation: 4142

Try to add a shebang line at the top of your entrypoint.sh

#!/bin/sh

flask db upgrade

supervisord -c /config/supervisord.conf

Upvotes: 2

Related Questions