Answers: <p>I suggest you mount your conf file as a volume:</p>
  
  <pre><code>docker run -v nginx.conf:/etc/nginx/nginx.conf ....
  </code></pre>
  
  <p>This way you can easily change the file outside the container and then just restart the container. If you change your config file inside the container and then you should have to restart nginx to pick-up the changes. At that point your container will stop because you stopped the main process.</p>
  
  <p>Your local nginx.conf should already have the initial configuration which you can copy from inside the container (cat /etc/nginx/nginx.conf).</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-05-08T09:01:17.960Z
Answers: 2019-05-08T09:01:17.960Z
Answers: Mihai
Body: <p>I'm having trouble figuring out how to edit <code>nginx.conf</code> inside NGINX open source Docker container.</p>
  
  <p>I'm trying to follow the directions here:</p>
  
  <p><a href="https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-docker/#maintaining-content-and-configuration-files-in-the-container" rel="nofollow noreferrer">https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-docker/#maintaining-content-and-configuration-files-in-the-container</a></p>
  
  <p>I've gotten through all 4 steps succcessfully. I have SSH access using the helper <code>mynginx4_files</code> container.</p>
  
  <p>This part confuses me, though:</p>
  
  <blockquote>
    <ul>
    <li>the /bin/bash argument means that the bash shell runs in the helper
    container, presenting a shell prompt that you can use to modify files
    as needed</li>
    </ul>
  </blockquote>
  
  <p>This sounds good! Unfortunately, I don't see any way I can modify <code>nginx.conf</code>. There's no text editor that I can see. I don't see <code>vi</code> or <code>emacs</code> or anything else. (I searched through all 4 'bin' directories, and <code>whereis</code> and <code>find</code> didn't turn up anything for <code>vi</code>.) I tried to install <code>vi</code> using <code>apt-get</code> but was unsuccessful. I even tried ubuntu instead of debian, but even with ubuntu there is no text editor. I thought vi is standard on all Linux distributions. I don't know what's up, but I feel like I'm missing something big here. Any help greatly appreciated.</p>
  
Tags: <docker><nginx>
Title: Docker NGINX issue -- unable to edit nginx.conf
UserDisplayName: Ringo
ThreadText: # Docker NGINX issue -- unable to edit nginx.conf
  
  (Asked by: username_0 on 2019-05-08)
  
  I'm having trouble figuring out how to edit `nginx.conf` inside NGINX open source Docker container.
  
  I'm trying to follow the directions here:
  
  <https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-docker/#maintaining-content-and-configuration-files-in-the-container>
  
  I've gotten through all 4 steps succcessfully. I have SSH access using the helper `mynginx4_files` container.
  
  This part confuses me, though:
  
  > * the /bin/bash argument means that the bash shell runs in the helper
  >   container, presenting a shell prompt that you can use to modify files
  >   as needed
  
  This sounds good! Unfortunately, I don't see any way I can modify `nginx.conf`. There's no text editor that I can see. I don't see `vi` or `emacs` or anything else. (I searched through all 4 'bin' directories, and `whereis` and `find` didn't turn up anything for `vi`.) I tried to install `vi` using `apt-get` but was unsuccessful. I even tried ubuntu instead of debian, but even with ubuntu there is no text editor. I thought vi is standard on all Linux distributions. I don't know what's up, but I feel like I'm missing something big here. Any help greatly appreciated.
  
  **Tags:** docker, nginx
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-05-08. Score: 1 | Accepted answer
  
  I suggest you mount your conf file as a volume:
  
  ```
  docker run -v nginx.conf:/etc/nginx/nginx.conf ....
  
  ```
  
  This way you can easily change the file outside the container and then just restart the container. If you change your config file inside the container and then you should have to restart nginx to pick-up the changes. At that point your container will stop because you stopped the main process.
  
  Your local nginx.conf should already have the initial configuration which you can copy from inside the container (cat /etc/nginx/nginx.conf).
  
  
  ---
  
  