Heroku: docker entrypoint not found

女生的网名这么多〃 提交于 2020-01-24 12:24:31

问题


I am trying to deploy a project on Heroku. I have set up bash entrypoint application, which is located in application root directory. Dockerfile content:

FROM node:10

# Create app directory
WORKDIR /usr/app

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

RUN npm install
# If you are building your code for production
# RUN npm ci --only=production

# Bundle app source
COPY . .

RUN entrypoint.sh

When heroku tries to deploy, it fails when calling entrypoint in this line:

RUN entrypoint.sh

It says that entrypoint.sh is not found - although it is located in project directory and it is added to container. See project structure here.


回答1:


Do you have heroku.yml in your root dir? If so, than in your heroku.yml under run statement you have probably defined same process, so that is why it is saying permission denied.

Two things here are important:

  1. If run command is defined in heroku.yml, then Heroku uses this command instead of the one defined in dockerfile.

  2. Use CMD statement as this is what Heroku executes, have a look at their documentation

If you don’t include a run section, Heroku uses the CMD specified in the Dockerfile.




回答2:


Use the ENTRYPOINT directive in docker file to set a script at entrypoint ENTRYPOINT ["./entrypoint.sh"] Also ensure it is executable (permissions)




回答3:


You're using RUN instead of ENTRYPOINT.

  • RUN means "run this command as part of build".
  • ENTRYPOINT means "set this command as what happens when you do docker run."


来源:https://stackoverflow.com/questions/59287314/heroku-docker-entrypoint-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!