title: Unable to change nginx.conf file
body: <p>I have a vagrant-box running CentOS6.7 on which I am running docker containers. I intend to run flask applications served by nginx inside the container. I had to make certain changes inside the nginx.conf file to serve my application (app1) by nginx. This may seem a little strange, but I am not able to change nginx.conf file inside /etc/nginx/conf.d/nginx.conf</p>
  
  <p>Here is what I did:</p>
  
  <h2>Method1: Change in Dockerfile</h2>
  
  <p>My Dockerfile looks like this:</p>
  
  <pre><code>FROM tiangolo/uwsgi-nginx-flask:flask
  COPY ./app /app
  COPY ./changes/nginx.conf /etc/nginx/conf.d/nginx.conf
  COPY ./changes/nginx.conf /app/
  </code></pre>
  
  <p>./changes/nginx.conf looks like this:</p>
  
  <pre><code>server {
      location /app1/ {
          try_files $uri @app;
      }
      location @app {
          include uwsgi_params;
          uwsgi_pass unix:///tmp/uwsgi.sock;
      }
      location /static {
          alias /app/static;
      }
  }
  </code></pre>
  
  <p><strong>Note the change in location in above server block from <code>location /</code> to <code>location /app1/</code></strong></p>
  
  <p>After the image is built and I run the docker container, I exec into the running container</p>
  
  <pre><code>sudo docker exec -ti CONTAINER_ID /bin/bash
  </code></pre>
  
  <p><code>cat /app/nginx.conf</code> shows presence of updated nginx.conf file (location changes from <code>/</code> to <code>/app1/</code></p>
  
  <p>BUT <code>cat /etc/nginx/conf.d/nginx.conf</code> still shows the old conf file (location is still <code>/</code>)
  I thought maybe the second COPY line is not getting executed successfully and docker isn't throwing error on console (sudo?). So, I changed the conf file manually and did a docker commit -  the second approach mentioned below.</p>
  
  <h2>Method2: Docker commit</h2>
  
  <p>After the docker container was up and running, I used exec to login into the container using </p>
  
  <pre><code>[vagrant@localhost]$ sudo docker exec -ti CONTAINER_ID /bin/bash
  
  [root@CONTAINER_ID]# vi /etc/nginx/conf.d/nginx.conf
  </code></pre>
  
  <p>Changing the file to reflect below:</p>
  
  <pre><code>server {
      location /app1/ {
          try_files $uri @app;
      }
      location @app {
          include uwsgi_params;
          uwsgi_pass unix:///tmp/uwsgi.sock;
      }
      location /static {
          alias /app/static;
      }
  }
  </code></pre>
  
  <p>Saved the file <code>wq!</code> and exit the container.
  After that I did <code>sudo docker commit CONTAINER_ID my_new_image</code></p>
  
  <p>Starting a new container and re-logging into container running on my_new_image still gives below nginx.conf file inside /etc/nginx/conf.d/nginx.conf:</p>
  
  <pre><code>server {
      location / {
          try_files $uri @app;
      }
      location @app {
          include uwsgi_params;
          uwsgi_pass unix:///tmp/uwsgi.sock;
      }
      location /static {
          alias /app/static;
      }
  }
  </code></pre>
  
  <p>I can tell that the my_new_image has some changes because it is larger in size than tiangolo/uwsgi-nginx-flask-docker because I had installed vim to edit the file. But somehow file changes are not persisting inside /etc/nginx/conf.d/nginx.conf</p>
  
  <p>What am I doing wrong?</p>
  
  <p><strong>UPDATE</strong>
  Github repo: <a href="https://github.com/VimanyuAgg/flask-nginx.git" rel="noreferrer">https://github.com/VimanyuAgg/flask-nginx.git</a></p>