Containers
What are some of the best practices regarding Containerfiles/Dockerfiles that you are following?
Difficulty: unrated
Source: bregman-arie/devops-exercises
by Arie Bregman
Answer
- Include only the packages you are going to use. Nothing else.
- Specify a tag in FROM instruction. Not using a tag means you'll always pull the latest, which changes over time and might result in unexpected result.
- Do not use environment variables to share secrets
- Use images from official repositories
- Keep images small! - you want them only to include what is required for the application to run successfully. Nothing else.
- If are using the apt package manager, you might want to use 'no-install-recommends' with
apt-get install to install only main dependencies (instead of suggested, recommended packages)