Hi,

I have been using Docker directly or indirectly for years now. During that time I shot myself in the foot multiple times by not following suggestions and good practices. I started collecting tips and practices and separated them into multiple categories. I am calling these categories Dockerfiles, images, and containers.

In this first part, I talk about Dockerfiles – I have included 6 tips and practices you should try and adopt. This is not meant to be an exhaustive list at all and I bet everyone has their own tips.

Dockerfiles
1. Use multi-stage builds
2. Use .dockerignore file
3. Add metadata to your images using LABEL
4. Use COPY instead of ADD
5. Treat Dockerfiles as code
6. Declare ENV when you need them (or at the end)

I have expanded more on each tip in the article.

submitted by /u/pj3677
[link] [comments]