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:
- Try to be “lean”. Your app is just that, your app, and usually, it should be the only thing running inside a container.
- 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)
- 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:)
- 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!