Docker

We use docker for several purposes, all of them related to code isolation and being able to replicate as much as we can the production environment:

  • To run our tests on Gitlab.
  • To package app components that can be deployed (instead of deploying a jar we deploy a container that runs that jar on a very specific and pre-configured environment, ie, proper java version, etc).
  • To be able to reproduce as much as we can staging, uat and production environments.

Generating a new image

  • We should always try to use images that end with -slim or -alpine first as they are lighter.
  • We should always try to derive images (FROM) a well known and heavily used existing base image. Same concepts as picking a library apply.
  • Images should be self contained and abstract enough to be able to be used in different projects if possible, i.e., NodeJS and Meteor base images.
  • Related to previous item, all the tools and code included should be open source and not related to any projects.
  • Ideally we would like to push this images to Docker Hub or to our own registry.
  • Image names should be descriptive sticking to the following pattern: Dockerfile-${name} where ${name} is our internal image name. Some examples: Dockerfile-jenkins, Dockerfile-nodejs, Dockerfile-meteor, Dockerfile-tomcat7
  • All the Dockerfiles should be committed and pushed to our Dockerfiles Repository so them can be improved if necessary.