Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run script file(.sh file) inside Dockerfile? [closed]

I am creating a Docker image. I have 'install.sh' script file and want to run this script file in Dockerfile.

How should i do this ?

like image 396
kalyani chaudhari Avatar asked Jul 08 '16 10:07

kalyani chaudhari


People also ask

How do I run a shell script in Dockerfile ENTRYPOINT?

Step 1: Create a script.sh file and copy the following contents. Step 2: You should have the script.sh is the same folder where you have the Dockerfile. Create the Dockerfile with the following contents which copy the script to the container and runs it part of the ENTRYPOINT using the arguments from CMD.

How do I close docker sh?

To exit out of the docker container bash shell. Just run exit or hit ctrl-D like you normally would.


1 Answers

Steps as follows :

  1. Copy '.sh' file to container

    COPY install.sh .
    
  2. Executing '.sh' file

    RUN ./install.sh
    

'install.sh' file should be in current working directory else you can specify path.

like image 159
kalyani chaudhari Avatar answered Oct 01 '22 00:10

kalyani chaudhari