Best practices for writing Dockerfiles 🗒️
General guidelines and recommendations
- Create ephemeral containers
- Understand build context
- Pipe Dockerfile through
stdin
- Exclude with .dockerignore
- Use multi-stage builds
- Don’t install unnecessary packages
- Decouple applications
- Minimize the number of layers
- Sort multi-line arguments
- Leverage build cache
Dockerfile instructions
- FROM
- LABEL
- RUN
- APT-GET
- USING PIPES
- CMD
- EXPOSE
- ENV
- ADD or COPY
- ENTRYPOINT
- VOLUME
- USER
- WORKDIR
- ONBUILD
References
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
Authors 👨💻
Group 4 Dockerfile summary
Group Members
Name | Position |
---|---|
Narongrit Rodphroboon (Joker) | Frontend Developer |
Suthinan Musitmani (Potae) | Backend Developer |
Kanawat Phuengphadung (Top) | Backend Developer |
Ekkarat Promrit (Big) | Frontend Developer |
Krittin Kanokwilairat (Tee) | Frontend Developer |