title: PyCharm can't open file from Docker container: No such file or directory
body: <p>I have a docker-compose.yml file that creates a Python image (named "flask") and a Postgres image (named "database"). When I attempt to run any of my Python scripts/files, I get the following message from my Python image:</p>
  
  <p><code>flask       | python: can't open file '/home/username/Projects/ProjectName/app/src/script.py": [Errno 2] No such file or directory</code></p>
  
  <p>If anyone could provide some insight or steps to resolve this issue, I would appreciate it. Thank you.</p>
  
  <p>docker-compose.yml:</p>
  
  <pre><code>version: '3.7'
  
  services:
          app:
                  container_name: flask
                  build:
                          context: ./app
                  ports:
                          - 8000:8000
                  depends_on:
                          - database
          database:
                  container_name: postgres
                  build:
                          context: ./postgres
                  ports:
                          - 5432:5432
  </code></pre>
  
  <p>app/dockerfile:</p>
  
  <pre><code>FROM python:3.8
  
  WORKDIR /app
  COPY requirements.txt .
  RUN python -m pip install -r requirements.txt
  EXPOSE 8000
  COPY . .
  CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--access-logfile", "-", "--error-logfile", "-", "--log-level", "debug",  "wsgi"]
  </code></pre>
  
  <p>postgres/dockerfile:</p>
  
  <pre><code>FROM postgres:latest
  
  COPY database_object_creation /init-queries/
  
  ENV POSTGRES_USER=username
  ENV POSTGRES_PASSWORD=password
  ENV PGPASSWORD=$POSTGRES_PASSWORD
  ENV POSTGRES_HOST=postgres
  ENV POSTGRES_PORT=5432
  ENV POSTGRES_DB=databasename
  
  COPY dbinit.sh /docker-entrypoint-initdb.d
  </code></pre>
  
  <p>Run/Debug Configurations in PyCharm:
  (some fields intentionally left blank)</p>
  
  <pre class="lang-none prettyprint-override"><code>Script path: /home/username/Projects/ProjectName/app/src/script.py
  Parameters:
  Environment variables: PYTHONUNBUFFERED=1
  Interpreter options:
  Working directory: /home/username/Projects/ProjectName/app/src
  Path mappings:
  Add content roots to PYTHONPATH: (checked)
  Add source roots to PYTHONPATH: (checked)
  Run with Python Console: (unchecked)
  Redirect input from:
  Command and options:
  Command preview:
  Before launch Activate tool window:
  </code></pre>
  
  <p>Project Remote Python Interpreter:
  (some fields intentionally left blank)</p>
  
  <pre class="lang-none prettyprint-override"><code>Name: Remote Python 3.8.1 Docker Compose (app at [/home/username/Projects/ProjectName/./docker-compose.yml])
  Docker Compose (checked)
  Server: Docker
  Configuration file(s): ./docker-compose.yml
  Service: app
  Environment variables:
  Python interpreter path: python
  Execute code using this interpreter with root privileges via sudo (unchecked)
  PyCharm helpers path: /opt/.pycharm_helpers
  </code></pre>
  
  <p>I've also noticed that PyCharm is creating (and maybe using?) this yml file.
  /home/username/.PyCharm2019.3/system/tmp/docker-compose.override.10.yml</p>
  
  <pre class="lang-none prettyprint-override"><code>version "3.7"
  services:
    app:
      command:
      - "python"
      - "-u"
      - "/home/username/Projects/ProjectName/app/src/script.py"
      environment:
        PYTHONPATH: "/home/username/Projects/ProjectName:/opt/.pycharm_helpers/pycharm_matplotlib_backend:/opt/.pycharm_helpers/pycharm_display"
        PYTHONUNBUFFERED: "1"
        PYTHONIOENCODING: "UTF-8"
        PYCHARM_HOSTED: "1"
        PYCHARM_DISPLAY_PORT: "63342"
      stdin_open: true
      volumes:
      - "/home/username/Projects/ProjectName/.:/opt/project:rw"
      - "pycharm_helpers_PY-193.5662.61:/opt/.pycharm_helpers"
      working_dir: "/home/username/Projects/ProjectName/app/src"
  volumes:
    pycharm_helpers_PY-193.5662.61: {}
  </code></pre>