Docker-compose "exec: \"/usr/src/app/entrypoint.sh\": permission denied"

Arif Oyong

This is based on https://testdriven.io/courses/microservices-with-docker-flask-and-react/

I'm running a docker file that will point to entrypoint.sh.

The docker-compose-f docker-compose-dev.yml build run successfully But running docker-compose-f docker-compose-dev.yml up shows

ERROR: for users  Cannot start service users: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"/usr/src/app/entrypoint.sh\": permission denied": unknown
ERROR: Encountered errors while bringing up the project.

I did try to run on interactive mode with docker run -it –tty users_app:latest sh. Running ./entrypoint.sh did work. But it didn't work with docker-compose.

Does anybody have the same issue?

This is my docker-compose-dev.yml, Dockerfile-dev, and entrypoint.sh

docker-compose-dev.yml

version: '3.6'

services:
  users:
    build:
      context: ./services/users
      dockerfile: Dockerfile-dev
    volumes:
      - './services/users:/usr/src/app'
    ports:
      - 5001:5000
    environment:
      - FLASK_APP=project/__init__.py
      - FLASK_ENV=development
      - APP_SETTINGS=project.config.DevelopmentConfig
      - DATABASE_URL=postgres://postgres:postgres@users-db:5432/users_dev
      - DATABASE_TEST_URL=postgres://postgres:postgres@users-db:5432/users_test    
    depends_on:
      - users-db

  users-db:  
    build:
      context: ./services/users/project/db
      dockerfile: Dockerfile
    ports:
      - 5435:5432
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres

Dockerfile-dev

# base image
FROM python:3.6.5-alpine

# install dependencies
RUN apk update && \
    apk add --virtual build-deps gcc python-dev musl-dev && \
    apk add postgresql-dev && \
    apk add netcat-openbsd

# set working directory
WORKDIR /usr/src/app

# add and install requirements
COPY ./requirements.txt /usr/src/app/requirements.txt
RUN pip install -r requirements.txt

# add app
COPY . /usr/src/app

# add entrypoint.sh
COPY ./entrypoint.sh /usr/src/app/entrypoint.sh
RUN chmod +x /usr/src/app/entrypoint.sh

# run server
#USER root
#RUN ["chmod", "+x", "/usr/src/app/entrypoint.sh"]
CMD ["/usr/src/app/entrypoint.sh"]

entrypoint.sh

#!/bin/sh

echo "Waiting for postgres..."
while ! nc -z users-db 5432; do
    sleep 0.1
done

echo "PostgresSQL started"

python manage.py run -h 0.0.0.0
Arif Oyong

Running the chmod +x /usr/src/entrypoint.sh in the source directory does work.
Docker is it's own system file, but it copies everything (including permission) from the source directory.

However, i couldn't understand, why running the RUN chmod +x /usr/src/app/entrypoint.sh in the dockerfile doesn't work

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

docker-compose up permission denied on sh file

/bin/sh: /root/start-docker.sh: Permission denied when exec command in docker

Docker compose permission denied with volume

docker run results in starting container process caused "exec: \"./boot.sh\": permission denied

Error: Starting container process caused "exec: \"/docker-entrypoint.sh\": permission denied"

===== docker migrate release ===== [FATAL tini (8)] exec /app/migrate.sh failed: Permission denied

Getting permission denied for /bin/sh to start Go server in production | docker-compose

Docker-compose doesn't work on ubuntu 20.04 [permission denied entrypoint.sh]

Wazuh Indexder throws /entrypoint.sh permission denied after running `docker-compose up`

Permission denied docker-entrypoint.sh

How to fix 'Permission denied' in Docker sh entrypoint

Docker exec fails, permission denied: unknown

docker-compose up Permission denied on Windows

docker compose down fails due to "permission denied"

Permission denied error with docker-compose volume

permission denied in docker-compose on linux

Permission Denied with Docker-Compose on Windows

How to fix bin/sh: can't create /etc/sysctl.conf: Permission denied when running docker-compose?

exec-maven-plugin cannot execute .sh script: permission denied

Permission denied to Docker container accessing NFS share - Docker Compose

Jenkinsfile: permission denied when running sh step in Docker container

podman MongoDB docker-entrypoint.sh permission denied

docker exec -> permission denied when executing through ssh

Docker Compose Make Shared Volume Writable Permission Denied

Permission denied when execute docker-compose command in Ubuntu Linux

docker-compose & dockerfile - php mkdir permission denied

docker-compose opening storage failed: permission denied error on running

How to reslove permission denied while building docker compose

permission denied with exec and composer

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    pump.io port in URL

  3. 3

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  4. 4

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  5. 5

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  6. 6

    BigQuery - concatenate ignoring NULL

  7. 7

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  8. 8

    ggplotly no applicable method for 'plotly_build' applied to an object of class "NULL" if statements

  9. 9

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  10. 10

    How to remove the extra space from right in a webview?

  11. 11

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  12. 12

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  13. 13

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

  14. 14

    java.lang.NullPointerException: Cannot read the array length because "<local3>" is null

  15. 15

    How to use merge windows unallocated space into Ubuntu using GParted?

  16. 16

    flutter: dropdown item programmatically unselect problem

  17. 17

    Pandas - check if dataframe has negative value in any column

  18. 18

    Nuget add packages gives access denied errors

  19. 19

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  20. 20

    Generate random UUIDv4 with Elm

  21. 21

    Client secret not provided in request error with Keycloak

HotTag

Archive