# Bash file isn't executing

**URL:** <https://forums.docker.com/t/bash-file-isnt-executing/45937>\
**Category:** General\
**Tags:** docker\
**Created:** [February 7, 2018, 4:28pm UTC](https://forums.docker.com/t/bash-file-isnt-executing/45937 "2018-02-07T16:28:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![amankh99](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@amankh99](https://forums.docker.com/u/amankh99)\
**Post date:** [February 7, 2018, 4:28pm UTC](https://forums.docker.com/t/bash-file-isnt-executing/45937/1 "2018-02-07T16:28:41Z")

</div>

I want my bash file to run whenever I the run the docker image, so firstly I created the Dockerfile inside a new directory say ‘demo’ and in that directory demo I created a new directory ‘home’ and in that directory I’ve my bash file - ‘[testfile.sh](http://testfile.sh)’.  
Here is my docker file -  
FROM ubuntu  
MAINTAINER Aman Khandelwal  
COPY . /home  
CMD /home/testfile.sh

On building it with command - 'sudo docker build -t amankh99/hello .'  
the following output was received -  
Sending build context to Docker daemon 3.584kB  
Step 1/4 : FROM ubuntu  
—\> 0458a4468cbc  
Step 2/4 : MAINTAINER Aman Khandelwal  
—\> Using cache  
—\> 98fbe31ed233  
Step 3/4 : COPY . /home  
—\> Using cache  
—\> 7e52ff3439e2  
Step 4/4 : CMD /home/testfile.sh  
—\> Using cache  
—\> 1d2660df6387  
Successfully built 1d2660df6387  
Successfully tagged amankh99/hello:latest

But when I run it with command - 'sudo docker run --name test -it amankh99/hello’  
it says - 'bin/sh: 1: /home/testfile.sh: not found’  
After having build successfully why it is unable to found the file.  
I want to convert this container in image and want to push on docker hub, so that I can run this with simple run command as we run the hello-world(sudo docker run hello-world) , I get my bash file executed, so what changes in dockerfile can I do to acheive this.

---

<div class="post-metadata">

**Author:** ![amankh99](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@amankh99](https://forums.docker.com/u/amankh99)\
**Post date:** [February 7, 2018, 7:31pm UTC](https://forums.docker.com/t/bash-file-isnt-executing/45937/2 "2018-02-07T19:31:41Z")

</div>

I’ve found the mistake, thanks for the attention.
