Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dockerfile can not find entrypoint script

I want to use a bash script as the entrypoint in the dockerfile. The code as blow:

ENV INST  INIT
ADD start.sh /start.sh
RUN chmod 777 /start.sh
ENTRYPOINT /start.sh $INST

It should be right. But when I build the image and run it, the result as below:

/bin/sh: 1: /start.sh: not found

Could anyone help me? Thanks. Total Dockerfile:

FROM debian:latest

ENV INST  INIT
RUN apt-get update
RUN apt-get install -y git build-essential gcc g++ vim 


RUN mkdir /Lab-C-Framework
WORKDIR /Lab-C-Framework
ADD Lab-C-Framework /Lab-C-Framework
RUN make install
RUN chmod 777 -R /Lab-C-Framework

RUN mkdir /project
ADD bin /project
ADD src /project
ADD header /project
ADD tests /project
ADD Docs /project
ADD Makefile /project
RUN chmod 777 -R /project

ADD start.sh /start.sh
RUN chmod 777 /start.sh

RUN mkdir /code
RUN chmod 777 /code
VOLUME /code 
WORKDIR /code


ENTRYPOINT /start.sh $INST
like image 634
haichiang Avatar asked Oct 17 '25 14:10

haichiang


1 Answers

It looks like the first line in your /start.sh script is pointing to something that doesn't exist. If it's a #!/bin/bash you would need to have bash installed in the image. And if your shell is installed in the container, make sure your first line doesn't have a windows linefeed at the end.

like image 198
BMitch Avatar answered Oct 19 '25 03:10

BMitch



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!