title: Entrypoint #FAIL - no such file or directory
body: <p>In getting a django env setup, was working on how to containerize the env. In doing so, I can't get the entrypoint to work on Docker for Windows/Linux.</p>
  
  <pre><code>Successfully built e9cb8e009d91
  Successfully tagged avengervision_web:latest
  avengervision_db_1 is up-to-date
  Starting avengervision_web_1 ... done
  </code></pre>
  
  <pre><code>CONTAINER ID        IMAGE                  COMMAND                  CREATED             
  1da83169ba41        avengervision_web      "sh /usr/src/app/ent…"   44 minutes 
  STATUS                      PORTS               NAMES
  Exited (2) 20 seconds ago                       avengervision_web_1
  </code></pre>
  
  <pre><code>docker logs 1da83169ba41
  sh: can't open '/usr/src/app/entrypoint.sh': No such file or directory
  </code></pre>
  
  <p>Have simplified the entrypoint.sh to just get it to execute.</p>
  
  <p>Have tried </p>
  
  <pre><code>ENTRYPOINT ["sh","/usr/src/app/entrypoint.sh"] &amp; 
  ENTRYPOINT ["/usr/src/app/entrypoint.sh"]
  </code></pre>
  
  <p>Made sure the line ending in git and vscode are set to LF and ran the code through dos2unix</p>
  
  <p>Ran the same Docker Compose on Windows and Linux and get the same exception on both</p>
  
  <p>added to the Dockerfile as extra precaution to remove all line endings and made sure to chmod +x the script</p>
  
  <p>Commented out the EntryPoint and ran docker run -tdi  and I was able to docker attach and execute the script from within the container without any issue.</p>
  
  <p>*****docker-compose.yml*****</p>
  
  <pre><code>version: '3.7'
  
  services:
    web:
      build: 
        context: .
        dockerfile: ./docker/Dockerfile
      #command: python manage.py runserver 0.0.0.0:8000
      volumes:
        - ./main/:/usr/src/app/
      ports:
        - 8000:8000
      environment:
        - DEBUG=1
        - SECRET_KEY=foo
        - SQL_ENGINE=django.db.backends.postgresql
        - SQL_DATABASE=hello_django_dev
        - SQL_USER=hello_django
        - SQL_PASSWORD=hello_django
        - SQL_HOST=db
        - SQL_PORT=5432
        - DATABASE=postgres
      depends_on:
        - db
    db:
      image: postgres:11.2-alpine
      volumes:
        - postgres_data:/var/lib/postgresql/data/
      environment:
        - POSTGRES_USER=hello_django
        - POSTGRES_PASSWORD=hello_django
        - POSTGRES_DB=hello_django_dev
  
  volumes:
    postgres_data:
  </code></pre>
  
  <p>*****Dockerfile*****</p>
  
  <pre><code># pull official base image
  FROM python:3.7-alpine
  
  # set work directory
  WORKDIR /usr/src/app
  
  # set environment varibles
  ENV PYTHONDONTWRITEBYTECODE 1
  ENV PYTHONUNBUFFERED 1
  
  # install psycopg2
  RUN apk update \
      &amp;&amp; apk add --virtual build-deps gcc python3-dev musl-dev \
      &amp;&amp; apk add postgresql-dev \
      &amp;&amp; pip install psycopg2 \
      &amp;&amp; apk del build-deps
  
  # install dependencies
  RUN pip install --upgrade pip
  RUN pip install pipenv
  COPY ./docker/Pipfile /usr/src/app/Pipfile
  RUN pipenv install --skip-lock --system --dev
  
  # copy entrypoint.sh
  COPY ./docker/entrypoint.sh /usr/src/app/entrypoint.sh
  #RUN chmod +x /usr/src/app/entrypoint.sh
  
  # copy project
  COPY main /usr/src/app/main
  COPY manage.py /usr/src/app
  #RUN /usr/src/app/entrypoint.sh
  
  RUN sed -i 's/\r$//' /usr/src/app/entrypoint.sh  &amp;&amp; \  
          chmod +x /usr/src/app/entrypoint.sh
  
  # run entrypoint.sh
  ENTRYPOINT ["sh","/usr/src/app/entrypoint.sh"]
  
  </code></pre>
  
  <p>*****entrypoint.sh*****</p>
  
  <pre><code>#!/bin/sh
  
  if [ "$DATABASE" = "postgres" ]
  then
      echo "Waiting for postgres..."
  
      while ! nc -z $SQL_HOST $SQL_PORT; do
        sleep 0.1
      done
  
      echo "PostgreSQL started"
  fi
  
  echo "Testing"
  #python /usr/src/app/manage.py flush
  #python /usr/src/app/manage.py migrate
  #python /usr/src/app/manage.py collectstatic --no-input --clear
  
  exec "$@"
  </code></pre>
  
  <p>The goal in the end is that the container would be up and running with the django application created.</p>