title: docker-compose build with url context and local Dockerfile
body: <p>The docker build context is defined as <a href="https://docs.docker.com/compose/compose-file/#context" rel="nofollow noreferrer">either a path to a directory containing a Dockerfile, or a url to a git repository</a>.</p>
  <p>With the <code>docker</code> command, it's possible to build an image using</p>
  <ul>
  <li><p>a local context and a local Dockerfile:</p>
  <p><code>docker build -t foobar [-f Dockerfile.local] .</code></p>
  </li>
  <li><p>a remote context and a remote Dockerfile:</p>
  <p><code>docker build -t foobar https://github.com/foobar/foobar [-f Dockerfile.remote]</code></p>
  </li>
  <li><p>a remote context and a local Dockerfile</p>
  <p><code>docker build -t foobar https://github.com/foobar/foobar -f- &lt; Dockerfile.local</code></p>
  </li>
  </ul>
  <p>The first two options easily translate to docker-compose:</p>
  <pre><code>services:
    first:
      build:
        context: .
        dockerfile: Dockerfile.local
    second:
      build:
        context: https://github.com/foobar/foobar
        dockerfile: Dockerfile.remote
  </code></pre>
  <p>The official documentation says nothing about injecting a local Dockerfile to a remote context with docker-compose. Is it possible?</p>