title: docker custom nginx container failed to start
body: <p>I am trying to build a nginx image from scratch (instead of using the official nginx image)</p>
  
  <pre><code>FROM ubuntu
  RUN apt-get update
  RUN apt-get install -y nginx    
  RUN rm -v /etc/nginx/nginx.conf
  ADD nginx.conf /etc/nginx/
  RUN echo "daemon off;" &gt;&gt; /etc/nginx/nginx.conf
  
  EXPOSE 80
  
  COPY ./files/ /var/www/html/
  
  CMD service nginx start
  </code></pre>
  
  <p>And this is my <code>nginx.conf</code> file under current directory. </p>
  
  <pre><code>server {
  
      root /var/www/html
  
      location / {
          index.html
      }
  
  }
  </code></pre>
  
  <p>And my dummy <code>index.html</code> file under <code>./files</code> folder</p>
  
  <pre><code>&lt;p1&gt;hello world&lt;/p1&gt;
  </code></pre>
  
  <p>I run this command </p>
  
  <pre><code>docker build -t hello-world .
  </code></pre>
  
  <p>And </p>
  
  <pre><code>docker run -p 80:80 hello-world
  </code></pre>
  
  <p>But I got error saying </p>
  
  <pre><code> * Starting nginx nginx
     ...fail!
  </code></pre>
  
  <p>What maybe the issue? </p>