title: Dockerfile vs docker-compose.yml
body: <p>What's the relation between <code>Dockerfile</code> and <code>docker-compose.yml</code> files?</p>
  
  <p>Looks like I can build any Linux setup using <code>Dockerfile</code> using <code>FROM</code>, <code>RUN</code> (<code>apt-get</code> etc. and <code>CMD</code> commands. But it seems, this is not much reusable (I can reuse the whole image, but the services are hardcdoded and not reusable by other projects).</p>
  
  <p>Shall I use both of the files on new projects?  </p>
  
  <p>Let's say I want to have regular LAMP stack:</p>
  
  <ul>
  <li>Linux OS (<code>debian:wheezy</code>)</li>
  <li>Apache web server (<code>httpd:2.2</code>)</li>
  <li>MySQL (<code>mariadb</code>)</li>
  <li>PHP (<code>php:5.6</code>)</li>
  </ul>
  
  <p>running together as on one, regular machine.</p>
  
  <p>And in a dir on my host system:</p>
  
  <ul>
  <li>volume for app source files</li>
  <li>vhost config file</li>
  <li>apache logs</li>
  <li>persistent data in db</li>
  </ul>
  
  <p>I prefer using official, base repos and images, not the pre-configured all-in-ones.</p>
  
  <p>How the config files are supposed to look like in this case?  </p>
  
  <p>I'm using <code>docker-compose</code> v.1.8.1 and <code>docker</code> v. 1.12.3 on Ubuntu.</p>