Search code examples
dockerentry-pointash

How to use "entry.sh" as ENTRYPOINT in a DOCKERFILE?


I have built a docker image from the following Dockerfile:

FROM cdi_monitoring:monitoring

ENTRYPOINT ["/bin/ash","-c","/entry.sh","/32ULC_subset"]

The cdi_monitoring is another image that I am extending and that is working properly. The path to my working directory is /home/casper/Downloads/data/32ULC_subset.

Now when I try to run the image built above I get the error /32ULC_subset: line 1: /entry.sh: not found .Here is how I am running the Dockerfile:

sudo docker run --name cdi_monitoring --rm -it -v /home/casper/Downloads/data/32ULC_subset/:/home/casper/Downloads/data/32ULC_subset/ cdi_monitoring:wrapper ./ChangeDetectionIL /home/casper/Downloads/data/32ULC_subset/ /home/casper/Downloads/data/32ULC_subset/Konfiguration_CD/IL_Liste.txt /home/casper/Downloads/data/32ULC_subset/Konfiguration_CD/

How can i fix this issue?


Solution

  • Well it seems you have path issues.

    What is the location of your file entry.sh ? Is it really located at root path (i.e : /) ?

    If not, you have two solutions. For the example, suppose your file is located in /home/casper/Downloads/data, then :

    • Solution 1 : You need to update your ENTRYPOINT and give the full path
    FROM cdi_monitoring:monitoring
    
    ENTRYPOINT ["/bin/ash","-c","/home/casper/Downloads/data/entry.sh","/home/casper/Downloads/data/32ULC_subset"]
    
    • Solution 2 : You need to set your WORKDIR before the ENTRYPOINT
    FROM cdi_monitoring:monitoring
    
    WORKDIR /home/casper/Downloads/data
    
    ENTRYPOINT ["/bin/ash","-c","./entry.sh","./32ULC_subset"]