I just had to add
user: root
in the docker-compose.yml file
It seems like docker-compose.yml file is executing the backend host as the user set in this Dockerfile and by adding user: root it knows to run it like root and not app.
The good news is that we do not give the permission x to the file as was intended in the first place. Do the docker exec -it … sh to the backend container and see for yourself
version: "3.8"
services:
frontend:
depends_on:
- backend
build: ./frontend
ports:
- 3000:3000
backend:
depends_on:
- db
build: ./backend
user: root
ports:
- 3001:3001
environment:
DB_URL: mongodb://db/vidly
command: ./docker-entrypoint.sh
db:
image: mongo:4.0-xenial
ports:
- 27017:27017
volumes:
- vidly:/data/db
volumes:
vidly: