docker automated builds

hub.docker.com gives you possibility to create your own docker hub account and to be able to create your own docker image for usage/sharing with team of for own usage.

One can use local docker-registry ( yum search docker-registry, I will blog more about it in future posts ) to avoid above all, but with docker automated builds you are not dependent on your local infrastructure, but your docker images are always available for you.

As first step navigate to hub.docker.com signup and create your own account there. You will be asked for mail and some other details, but nothing scary.You will be done in less than 1 minute.

Key word here is docker automated build,and to have this fully automated, it is necessary to use github ( or bitbucket.com from where you will pull Dockerfiles to hub.docker.com what will be then starting point for building docker images.

After creating hub.docker.com and github account,the whole process works like this

  1. on local machine ( or directly at github repository ) create Dockerfile, where you specify all what you want to have in docker image once it built, and example Dockerfile you can try is Example Dockerfile
  2. Go back to hub.docker.com and login there, then Add repository->Automated build->Select Github and point to repository where Dockerfile is located. You might be asked to autenthicate docker to access your github account, but that is necessary to do only once  – first time you try to set up this
  3.  That is

Once above is done and once you authorize hub.docker.com to access github and pull from there Dockerfile, it will automatically start to build your image. The build process duration will depend on what packages you specified to be installed.The more packages it needs to install,the longer build process will last.

Now,if you want to update docker image, all you need to do is to update Dockerfile and push it to github.Once pushed to github the build process will automatically start and this time it will last shorter – docker build process is smart and it will just build parts which changed.

Once docker images is built you can pull it with

$docker pull repository/image

Happy docker-ing 🙂

Advertisements

#centos, #docker, #dockerfile, #linux