An excellent article sent to me by a friend pointing out some of the important things to do/remember when creating Dockerfiles.

You should also check out:

Some key things to remember from a top level standpoint whilst getting started:

  1. Try to be “lean”. Your app is just that, your app, and usually, it should be the only thing running inside a container.
  2. Keep your build directory clean, using .dockerignore and .gitignore files where necessary, and using tarballs instead of extracted directories (e.g. ADD lol.tgz /opt/lol)
  3. Remember that each Dockerfile line/command adds one layer to your image. If you can do multiple things in one “RUN” for instance, you can save quite a bit of space:)
  4. Comment! Sometimes there are weird things you must do to make things work…don’t be in a situation where you try to remember why you echo something into a configuration file!

Now go and containerize!

Mario Loria is a builder of diverse infrastructure with modern workloads on both bare-metal and cloud platforms. He's traversed roles in system administration, network engineering, and DevOps. You can learn more about him here.