The docker build context is defined as either a path to a directory containing a Dockerfile, or a url to a git repository.
With the docker command, it's possible to build an image using
a local context and a local Dockerfile:
docker build -t foobar [-f Dockerfile.local] .a remote context and a remote Dockerfile:
docker build -t foobar https://github.com/foobar/foobar [-f Dockerfile.remote]a remote context and a local Dockerfile
docker build -t foobar https://github.com/foobar/foobar -f- < Dockerfile.local
The first two options easily translate to docker-compose:
services:
first:
build:
context: .
dockerfile: Dockerfile.local
second:
build:
context: https://github.com/foobar/foobar
dockerfile: Dockerfile.remote
The official documentation says nothing about injecting a local Dockerfile to a remote context with docker-compose. Is it possible?