Docker: how to build an image from a non-master branch on Github repository

The doc that you quoted itself mentions how you can specify the branch:

github.com/scollier/Fedora-Dockerfiles/tree/master/apache

Change tree/master to the branch you want and see.


I proposed this question on #docker at the Freenode IRC and the user scollier contacted me and he said that he'll get back to me about this issue. I believe he is involved with the Docker documentation that I mentioned in my questions. In the meantime, I found a workaround by adding the following to my Dockerfile:

RUN git clone something && cd something && git checkout branch

This solution seems to solve all my needs. Thanks for the support!


docker build -t myAccount/myImage https://github.com/myAccount/docker-myImage.git#development

See docker build command reference for more options.