Search code examples
githubdockerbranchdocker-build

Can't build docker image from github repository branch


I have a private GitHub repository containing 2 branches: master and stage. Repository contains a Dockerfile and other files necessary to build a container image. According to the documentation I can specify the branch when calling docker build command.

However, I am able to run:

sudo docker build -t="superimage" https://github.com/organization/repo.git

After this I am asked for my GitHub login and password.

But when I try to run:

https://github.com/organization/repo.git#stage

I am getting:

Error: Got HTTP status code >= 400: 404 Not Found

What am I doing wrong?


Solution

  • According to the changelog (https://github.com/docker/docker/blob/master/CHANGELOG.md#170-2015-06-16) the building of specific git branches appears to be a feature introduced in 1.7. You'll need to upgrade to 1.7+ to get this functionality.