Use COPY instead of ADD because it is more transparent (no additional
functionality like tar extraction)
Use RUN with wget or curl instead of ADD so that unused files can be
deleted to reduce image size (as part of the same RUN to not add any
additional layers)
Use multi-stages builds
Use package trimming commands e.g. --without-recommends
Best practices for builds
In most cases the Dockerfile should be in an empty directory, if not use
.dockerignore (docker build . uses . as the context which is tar’d
and sent to the docker daemon).
If no context is needed read from stdin: docker build - < Dockerfile
Design for “cattle”
Strange stuff for files
One layer per file - high ops cost (tons of layers)
One layer per image - high storage cost (duplication)
All files in a single layer - high network cost (pull all, always)
Wale: reduction of shared libraries by creating a core image with preprocessing
DIVA: Docker image vulnerability analysis - find problems in base images, avoid
vulnerability propagation
Runtime Quality
ChaosORCA architecture: fault injection at system call level
Simon Anliker Someone has to write all this stuff.