Dockerfile Tips & Tricks

Last week was Docker Global Mentor Week, and thought it would be cool (and useful:) to collect our tips & tricks working with Docker on resin.io.

A lot of the info is already available at the Build Optimisations page in the docs, but there were a few that only crystallised recently, after creating and debugging a bunch of projects. The post is here: Our Dockerfile Tips & Tricks, and include such things as:

  • pin software versions
  • clean up after yourself
  • combine RUN statements logically
  • order Dockerfile statements
  • use .dockerignore
  • always add MAINTAINER
  • use a start script
  • create a non-root user

Check out the post for more details! Would be happy to hear if I’ve missed anything interesting that you consider best practice!

Well, MAINTAINER has just been deprecated, so scratch that recommendation, use a README for the same purpose probably.