|
| 1 | +Summary |
| 2 | +======= |
| 3 | + |
| 4 | +1. Use available tools |
| 5 | + a. Use ready-made images (e.g. from Docker Hub) |
| 6 | + b. Dockerfile generators (e.g. repo2docker) |
| 7 | + c. Linters |
| 8 | + d. Project templates (e.g. [cookie cutter](https://github.com/cookiecutter/cookiecutter)) [new] |
| 9 | +2. Use versioned images |
| 10 | + a. Use version-tagged base images |
| 11 | + b. Publish your own images with version tags [revise] |
| 12 | +3. Format for clarity |
| 13 | + a. Use indentation, line breaks and unabbreviated arguments |
| 14 | + b. Clarity is better than brevity |
| 15 | + c. Group related commands |
| 16 | +4. Document within the Dockerfile |
| 17 | + a. Add comments explaining the instructions |
| 18 | + b. Use labels for metadata |
| 19 | + c. Include usage instructions |
| 20 | +5. Specify software versions |
| 21 | + a. Pin system library versions |
| 22 | + b. Explictly list package versions to install |
| 23 | + c. Comment why each is needed |
| 24 | +6. Use version control |
| 25 | + a. Use Continuous Integration and automated testing |
| 26 | + b. Include scripts (and requirements.txt) in the same repository |
| 27 | +7. Mount datasets at run time |
| 28 | + a. Use bind mounts for accessibility |
| 29 | + b. Keep large or sensitive datasets out with `.dockerignore` |
| 30 | + c. Document expected mounts for external resources |
| 31 | +8. Make it one-click runnable |
| 32 | + a. Set default behaviour with `CMD` and `ENTRYPOINT` |
| 33 | + b. Document how to use it interactively |
| 34 | +9. Order the instructions |
| 35 | + a. Least --> most changable for caching and fast builds |
| 36 | + b. Regularly use `--no-cache` to catch problems [duplicate: 10b] |
| 37 | +10. Regularly use and rebuild containers |
| 38 | + a. Use the container throughout each project for confidence in your workflow |
| 39 | + b. Rebuild every 1-2 weeks with `--no-cache` to catch problems |
| 40 | + c. Provide a `Makefile` or script for convenience |
| 41 | + d. Ask a colleague to try it |
| 42 | + e. Publicly archive the image used for the publication |
0 commit comments