title: Running Django in docker-compose
body: <p>I have a problem starting a django project inside a docker container. My Dockerfile looks as follows:</p>
  
  <pre><code>FROM python:2.7
  ADD . /code
  WORKDIR /code
  RUN pip install -r requirements.txt
  EXPOSE 8000
  </code></pre>
  
  <p>The <code>requirements.txt</code> consists of the single line <code>Django</code> which install django successfully.</p>
  
  <p>My <code>docker-compose.yml</code> has the following content:</p>
  
  <pre><code>version: '2'
  services:
    web:
      build: ./web
      command: python manage.py runserver 0.0.0.0:8000
      ports:
       - "8000:8000"
      volumes:
       - ./web:/code
  </code></pre>
  
  <p>To create a project I am calling:</p>
  
  <pre><code>docker-compose run web python django-admin.py startproject web .
  </code></pre>
  
  <p>which crashes with the following message:</p>
  
  <pre><code>python: can't open file 'django-admin.py': [Errno 2] No such file or directory
  </code></pre>
  
  <p>Also this</p>
  
  <pre><code>docker-compose run web django-admin.py startproject web .
  </code></pre>
  
  <p>crashes with</p>
  
  <pre><code>ERROR: Cannot start service web: oci runtime error: container_linux.go:247: starting container process caused "exec: \"django-admin.py\": executable file not found in $PATH"
  </code></pre>
  
  <p>It seems to me that there is an error in the <code>$PATH</code> when executing the container like this. When I use the interactive mode <code>-it</code>, I am able to call the <code>django-admin</code> from this folder. Is the <code>PATH</code> not set correctly or am I doing something else wrong here? The <code>Dockerfile</code> is in the directory <code>web</code>.</p>
  
  <p>Edit: After the suggestion in the comment, I tried to run the <code>django-admin</code> with the full path:</p>
  
  <pre><code>root@935ca5543589:/code# which django-admin
  /usr/local/bin/django-admin
  </code></pre>
  
  <p>Still no change:</p>
  
  <pre><code>docker-compose run web /usr/local/bin/django-admin startproject web .
  ERROR: Cannot start service web: oci runtime error: container_linux.go:247: starting container process caused "exec: \"/usr/local/bin/django-admin\": stat /usr/local/bin/django-admin: no such file or directory"
  </code></pre>