title: uWSGI - chdir(): No such file or directory [core/uwsgi.c line 2629]
body: <p>I am unable to start a dockerized Django application using uWSGI.
  Below is the configuration being used.</p>
  
  <p>Dockerfile</p>
  
  <pre><code>FROM python:3.6
  ENV PYTHONUNBUFFERED 1
  RUN apt-get update
  RUN apt-get install -y swig libssl-dev dpkg-dev netcat unixodbc-dev python-dev libldap2-dev libsasl2-dev
  RUN mkdir /code
  WORKDIR /code
  COPY app/ /code/
  RUN pip install -U pip
  ENV PIP_TRUSTED_HOST="pypi.python.org pypi.org files.pythonhosted.org"
  RUN apt-get install ca-certificates
  RUN pip install -Ur requirements.txt
  RUN chmod -R 777 /code
  CMD ["/code/run.sh"]
  </code></pre>
  
  <p>run.sh</p>
  
  <pre><code>#!/bin/bash
  
  ./manage.py migrate
  uwsgi --ini uwsgi.ini
  </code></pre>
  
  <p>app/uwsgi.ini</p>
  
  <pre><code>[uwsgi]
  http-socket = :8000
  chdir = /opt/code/
  module = app.wsgi:application
  master = 1
  processes = 2
  threads = 2
  </code></pre>
  
  <p>Error when starting the container</p>
  
  <pre><code>Operations to perform:
    Apply all migrations: admin, api, auth, contenttypes, sessions
  Running migrations:
    No migrations to apply.
  [uWSGI] getting INI configuration from uwsgi.ini
  *** Starting uWSGI 2.0.17 (64bit) on [Wed May 30 05:35:23 2018] ***
  compiled with version: 6.3.0 20170516 on 30 May 2018 05:34:47
  os: Linux-4.9.12-moby #1 SMP Tue Feb 28 12:11:36 UTC 2017
  nodename: 0a9f49a479c7
  machine: x86_64
  clock source: unix
  pcre jit disabled
  detected number of CPU cores: 6
  current working directory: /code
  detected binary path: /usr/local/bin/uwsgi
  uWSGI running as root, you can use --uid/--gid/--chroot options
  *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
  chdir() to /opt/code/
  chdir(): No such file or directory [core/uwsgi.c line 2629]
  </code></pre>
  
  <p>Can someone help me figure out what seems to be the problem with this configuration?</p>
  
  <p>The following is the project structure - </p>
  
  <pre><code>project
  |--app
     |--app
     |--requirements.txt
     |--run.sh
     |--uwsgi.ini
     |--manage.py
  |--Dockerfile
  </code></pre>