title: Executing wait-for-it.sh in python Docker container
body: <p>I have a Python docker container that needs to wait until another container (postgres server) finishes setup.  I tried the standard wait-for-it.sh but several commands weren't included. I tried a basic sleep (again in an sh file) but now it's reporting <code>exec: 300: not found</code> when trying to finally execute the command I'm waiting on.</p>
  
  <p>How do I get around this (preferably without changing the image, or having to extend an image.)</p>
  
  <p>I know I could also just run a Python script, but ideally I'd like to use wait-for-it.sh to wait for the server to turn up rather than just sleep.</p>
  
  <p>Dockerfile (for stuffer):</p>
  
  <pre><code> FROM python:2.7.13
  
   ADD ./stuff/bin /usr/local/bin/
   ADD ./stuff /usr/local/stuff
   WORKDIR /usr/local/bin
  
   COPY requirements.txt /opt/updater/requirements.txt
   COPY internal_requirements.txt /opt/stuff/internal_requirements.txt
  
   RUN pip install -r /opt/stuff/requirements.txt
   RUN pip install -r /opt/stuff/other_requirements.txt
  </code></pre>
  
  <p>docker-compose.yml:</p>
  
  <pre><code> version: '3'
   services:
     local_db:
       build: ./local_db
       ports:
       - "localhost:5432:5432"
  
     stuffer:
       build: ./
       depends_on:
       - local_db
       command: ["./wait-for-postgres.sh", "-t", "300", "localhost:5432", "--", "python", "./stuffing.py", "--file", "./afile"]
  </code></pre>
  
  <p>Script I want to use (but can't because no psql or exec):</p>
  
  <pre><code> #!/bin/bash
   # wait-for-postgres.sh
  
   set -e
  
   host="$1"
   shift
   cmd="$@"
  
   until psql -h "$host" -U "postgres" -c '\l'; do &gt;&amp;2 echo "Postgres is unavailable - sleeping"
     sleep 1
   done
  
   &gt;&amp;2 echo "Postgres is up - executing command"
   exec $cmd
  </code></pre>