How can I make docker-compose build an image from a remote git repository?

Docker-compose allows you to utilize either preƫxisting docker images or build from source. For the build option, the official reference requires

Either a path to a directory containing a Dockerfile, or a url to a git repository.

  • Error: unknown shorthand flag: 'r' in -r
  • Docker for development and production
  • How do I change the default docker container location?
  • Docker on Windows 10. E: Unable to locate package. Returns non-zero code 123
  • Docker-machine create: Error with pre-create check: “Hyper-v commands have to be run as an Administrator”
  • How to set heap size for wildfly inside Docker container?
  • I’d like to take advantage of the latter case, so that I don’t have to create a git submodule in my project, or register a new repository on Docker Hub. Unfortunately, there are no examples for how to format the url, and every form I’ve tried is mistaken for a relative file path.



    Fails with the error:

    ERROR: build path /{MY_CURRENT_PATH}/https:/ either does not exist or is not accessible.

    I didn’t have any more luck with the other forms I’ve tried:

    • git://

  • How to start Aerogear unified push server with Mysql in docker environment
  • Error running docker and nodemcu-build in linux (debian)
  • Running yum update in fedora 21 makes a very large image
  • how to sync mac local directory with native docker container?
  • Docker restart not showing the desired effect
  • Docker, and small production server infrastructure advices
  • 2 Solutions collect form web for “How can I make docker-compose build an image from a remote git repository?”

    Are you running version 1.5.2? It looks like this was actually recently added in Try upgrading.


    version: '2'
        image: "redis:3.2.3"
        hostname: redis
        command: --redis-host redis
          - "redis:redis"
          - 8081

    Tested with:

    $ docker-compose -v
    docker-compose version 1.11.2, build dfed245

    The file tests/unit/config/ shows:

    def test_valid_url_in_build_path(self):
        valid_urls = [

    This is confirmed with compose/config/

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.