Can I put my docker repository/image on GitHub/Bitbucket?

So the way to go is:

  1. Create a repository on Github or Bitbucket
  2. Commit and push your Dockerfile (with config files if necessary)
  3. Create an automated build on Docker Hub which uses the Github / Bitbucket repo as source.

In case you need it all private you can self-host a git service like Gitlab or GOGS and of course you can also selfhost a docker registry service for the images.


In general you don't want to use version control on large binary images (like videos or compiled files) as git and such was intended for 'source control', emphasis on the source. Technically, here's nothing preventing you from doing so and putting the docker image files into git (outside the limits of the service you're using).

One major issue you'll have is git/bitubucket have no integration with Docker as neither provide the Docker Registry api needed for a docker host to be able to pull down the images as needed. This means you'll need to manually pull down out of the version control system holding the image files if you want to use it.

If you're going to do that, why not just use S3 or something like that?

If you really want 'version control' on your images (which docker hub does not do...) you'd need to look at something like: https://about.gitlab.com/2015/02/17/gitlab-annex-solves-the-problem-of-versioning-large-binaries-with-git/

Finally, docker hub only allows one FREE private repo. You can pay for more.

Tags:

Docker