I published an article about Anti-patterns in Docker today, on Constant Contact tech blog. In the editing process, some thoughts were cut from the main article but I thought I’d share these tips, follow up:
- Don’t store data or configuration files in containers, keep them on shared volumes where they can be backed up easily by other containers.
- Use remote log collection for your logs
- Don’t leave your build artifacts laying around: Minimal Containers
- Are Centos, RedHat, Ubuntu, Debian the right distros for containers? Look into ArchLinux, CoreOS and UniKernels
- Think about generic images that could run any properly structured app on a given stack. For example, this image could be to run pretty much any node.js with good package.json file.
- Reach out beyond basic Dockerfile & docker commands and learn the differences between similar looking commands & understand the intention behind those differences.
- Comprehend the impact of ADD & VOLUMES as cache invalidators
- Imagine what you can do with onbuild, container linking, , volumes and environment variables
- Files and sub directories under the current directory are added to the context, which is sent to your Docker demon because it might be running on a remote machine. Only place files and directories that you need to add to image under the current directory.