docker entrypoint running bash script gets “permission denied”

前端 未结 6 1768
北海茫月
北海茫月 2020-12-07 10:48

I\'m trying to dockerize my node.js app. When the container is built I want it to run a git clone and then start the node server. Therefore I put these operatio

6条回答
  •  生来不讨喜
    2020-12-07 11:32

    This is an old question asked two years prior to my answer, I am going to post what worked for me anyways.

    In my working directory I have two files: Dockerfile & provision.sh

    Dockerfile:

    FROM centos:6.8
    
    # put the script in the /root directory of the container
    COPY provision.sh /root
    
    # execute the script inside the container
    RUN /root/provision.sh
    
    EXPOSE 80
    
    # Default command
    CMD ["/bin/bash"]
    

    provision.sh:

    #!/usr/bin/env bash
    
    yum upgrade
    

    I was able to make the file in the docker container executable by setting the file outside the container as executable chmod 700 provision.sh then running docker build . .

提交回复
热议问题