In a nutshell: use git repositories as docker repositories (if you don’t mind the build being done locally).
Background: After realizing on our last project that setting up + running a private Docker registry is non-trivial, my buddy had what I think is a great idea: why not just use git + docker build? So recently I sat down and wrote docker-get, which allows you to do just that:
$ docker-get github.com/codemy/dockerfile/redis
$ docker run -it github.com/codemy/dockerfile/redis
You can also pull a specific tag / branch / commit, which will produce a corresponding docker tag:
$ docker-get github.com/codemy/dockerfile/redis:master
$ docker run -it github.com/codemy/dockerfile/redis:master
or
$ docker-get github.com/codemy/dockerfile/redis:07dd89aba13aa46af2b53d72f91567cc1a9fe941
$ docker run -it github.com/codemy/dockerfile/redis:07dd89aba13aa46af2b53d72f91567cc1a9fe941
The repos are checked out to and cached in a $DOCKERPATH, analogously to go get’s $GOPATH.
Since it’s just a shell script calling git and docker, the whole thing works for any repo your git can reach.
This is extremely trivial though. What problems did you run into?
Although it’s not obvious, docker content trust is a way better security framework than git repositories (even with signed git tags). I just wanted to point that out in case you were not aware of it.
I’m also curious to see how does this work with nested
FROMstatements? What happens if I have a FROM [git-hosted-thing], do I have to do docker-get [git-hosted-thing] and then do my build?Either way, it sounds like a fun hackathon-like idea. Congrats!
edit: Sorry I didn’t mean to come off as condescending (I just realized it does after re-reading what I wrote). I’m sorry….