title: Building and uploading images to Docker Hub, how to from Docker Compose?
body: <p>I have been working in a <code>docker</code> environment for PHP development and finally I get it working as I need. This environment relies on <code>docker-compose</code> and the config looks like:</p>
  
  <pre><code>version: '2'
  services:
      php-apache:
          env_file:
            - dev_variables.env
          image: reynierpm/php55-dev
          build:
              context: .
              args:
                  - PUID=1000
                  - PGID=1000
          ports:
              - "80:80"
          extra_hosts:
              - "dockerhost:xxx.xxx.xxx.xxx"
          volumes:
              - ~/var/www:/var/www
  </code></pre>
  
  <p>There are some configurations like <code>extra_hosts</code> and <code>env-file</code> that is giving me some headache. Why? Because I don't know if the image will works under such circumstances. </p>
  
  <p>Let's said:</p>
  
  <ul>
  <li>I have run <code>docker-compose up -d</code> and the image <code>reynierpm/php55-dev</code> with tag <code>latest</code> has been built</li>
  <li>I have everything working as it should be because I am setting the proper values on the <code>docker-compose.yml</code> file</li>
  <li>I have logged in into my account and I push the image to the repository: <code>docker push reynierpm/php55-dev</code></li>
  </ul>
  
  <p>What happen if tomorrow you clone the repository and try to run <code>docker-compose up</code> but changing the <code>docker-compose.yml</code> file to fit your settings? How the image behaves in this case? I mean makes sense to create/upload the image to Docker Hub if any time I run the command <code>docker-compose up</code> it will be build again due to the changes on the config file?</p>
  
  <p>Maybe I am completing wrong and some magic happen behind scenes but I need to know if I am doing this right</p>