title: Changes to filesystem inside container not reflected on host in docker volume
body: <p>I am working on an Express server written on TypeScript. The flow of the project is that I have a npm build script in place which takes project files in src folder and compiles them to the dist folder. Both these folders live under the root directory. The project works, but while trying to move everything to docker, although I am mounting the volume and the built files (dist directory) is there in the container, the changes are not reflected on host. (I am using Windows + VirtualBox for Docker)</p>
  
  <p>I have referred to <a href="https://stackoverflow.com/questions/40460271/changes-made-inside-attached-volume-in-container-not-coming-up-in-host-volume">this</a> and <a href="https://stackoverflow.com/questions/51192119/directory-created-inside-docker-container-not-reflecting-on-host-machine">this</a> questions. I see that their scenario is same, but their solutions don't seem to work for me. I made sure I am using similar techniques mentioned in answers to these, they don't seem to work.</p>
  
  <p>Directory Structure of the Project:</p>
  
  <pre><code>├── Backend
  │   ├── src/
  │   │   ├── controllers/
  │   │   ├── models/
  │   │   ├── routes/
  │   │   ├── services/
  │   │   ├── index.ts
  │   │   └── server.ts
  │   ├── dist/ (Created upon compilation)
  │   │   ├── controllers/
  │   │   ├── data/ (Created upon starting the server)
  │   │   ├── models/
  │   │   ├── routes/
  │   │   ├── services/
  │   │   ├── index.js
  │   │   └── server.js
  │   ├── Dockerfile
  │   ├── package.json
  │   ├── tsconfig.json
  │   ├── tslint.json
  │   └── .env
  ├── Frontend/ (This part is an independent application)
  ├── docker-compose.yml
  └── README.md
  
  </code></pre>
  
  <p>When the server starts, it creates a directory in <code>%proj_root%/Backend/dist</code> named <code>data</code> which is used to give input to the application via txt files. Compilation works fine as evident from ls commands I have put in Dockerfile, but the changes done inside of the container (creation of the dist directory) isn't reflected on host. On host, the dist directory is empty, causing the server to crash because there is no server.js file.</p>
  
  <p>Here is my docker-compose.yml:</p>
  
  <pre><code>version: "3"
  services:
    backend:
      build:
        context: ./Backend/
      volumes:
        - ./Backend/dist:/app/dist
        - /app/node_modules
        - ./Backend:/app
    frontend:
      build:
        context: ./Frontend
      ports:
        - "3001:8080"
      volumes:
        - /app/node_modules
        - ./Frontend:/app
  </code></pre>
  
  <p>Here's the Dockerfile for Backend service:</p>
  
  <pre><code>FROM node:8
  WORKDIR /app
  COPY ./package.json .
  RUN npm install
  COPY . . # Copying everything to enable standalone usage
  RUN ls # Logging before tsc build
  RUN npm run build
  RUN ls /app/dist # Logging after tsc build. All the built files are visible.
  CMD ["npm", "run", "start"]
  </code></pre>
  
  <p>Upon running <code>docker-compose up</code>, a dist folder should be created in container (<code>/app/dist</code>) and should be reflected on host as <code>%proj_root%/Backend/dist</code></p>
  
  <p>I understand I could create a script which compiles TS and then runs docker-compose, but that looks like a hacky approach to me. Is there a better solution?</p>