title: Docker cant run script executable file not found in $PATH"
body: <p>I'm running a small tesseract API using docker. The ruby app calls the command line to use tesseract on an image. Before it does so it uses a script to pre-process the image first:</p>
  
  <pre><code>post '/extractText' do
    begin
      bas64Image = Base64.decode64(params[:image])
      imageFile = Tempfile.new(['image', '.jpg'])
      imageFile.write(bas64Image)
      imageFile.close
      `textcleaner #{imageFile.path} #{imageFile.path}`
      output = `tesseract #{imageFile.path} --psm 6 stdout`
      p output
    rescue
      status 402
      return "Error reading image"
    end
    status 200
    return output.to_json
  end
  </code></pre>
  
  <p>the app ignores the line <code>textcleaner #{imageFile.path} #{imageFile.path}</code> currently as it does nothing. </p>
  
  <p>When testing in command line with something like <code>docker run tess textcleaner receipt3.jpg receipt3.jpg</code> i get the following error:</p>
  
  <pre><code>container_linux.go:265: starting container process caused "exec: \"textcleaner\": executable file not found in $PATH"
  docker: Error response from daemon: oci runtime error: container_linux.go:265: starting container process caused "exec: \"textcleaner\": executable file not found in $PATH".
  ERRO[0000] error waiting for container: context canceled
  
  FROM tesseractshadow/tesseract4re
  
  RUN apt-get update &amp;&amp; apt-get install -y build-essential ruby-full libffi-dev libgmp3-dev ruby-dev
  
  WORKDIR /home/work
  
  RUN gem install bundler
  
  COPY Gemfile .
  COPY textcleaner /home/work
  RUN chmod +x /home/work/textcleaner
  
  RUN bundle install
  
  COPY . /home/work
  
  EXPOSE 8080
  
  CMD bundle exec ruby app.rb
  </code></pre>
  
  <p>I dont know how to add the file to $PATH. When i do:</p>
  
  <pre><code>COPY textcleaner $PATH
  RUN chmod +x $PATH/textcleaner 
  </code></pre>
  
  <p>I get </p>
  
  <pre><code>chmod: cannot access '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin/textcleaner': Not a directory
  The command '/bin/sh -c chmod +x $PATH/textcleaner' returned a non-zero code: 1
  </code></pre>
  
  <p>on the second line.</p>
  
  <p>Any help would be appreciated</p>