Overview#
The DockerHub website was created by Docker to allow developers to automate the Docker images build and push the image into the Docker repository. In this way you don’t need to use your CPU time to build the image and not even your bandwidth to upload the image into the Docker repository to allow others to pull it.
The procedure to configure DockerHub is really simple.
Configuration#
1) Create a repository pointing to your source repository (GitHub repo):

2) Configure then for your repository the branch and/or tag you want to auto-check for builds.
/^v.[0-9.]+$/
an image is built using the same version as the one used into the tagname.
Examples:
- v.0.10.1 tag triggers a build of an image tagged as v.0.10.1
- update_dockerfile tag is ignored by dockerhub
3) Change your code on the associated GitHub repo and push code (and tags if needed).
You can see if any build is started on the Build Details page.





Building#
5) As I said at the beginning, all images built using this method are available on the Docker repository. This means you can simply pull the desired image/tag.
sudo docker pull mmornati/docker-ghostblog:v0.10.0INFO: all images built using this method are “fresh” image. This means that all the intermediate steps are removed for any new build. In my example it is important to have this because one of the steps into the Dockerfile is downloading a file from internet (ghost latest version). If you keep all the build steps there’s no guarantee to have the Ghost’s latest version into your Docker.
# Install Ghost
RUN \
cd /tmp && \
wget https://ghost.org/zip/ghost-latest.zip && \
unzip ghost-latest.zip -d /ghost && \
rm -f ghost-latest.zipConclusion#
It is easy and quick, isn’t it? :)