Docker Dockerfile
Multistage Dockerfiles
- Multi-stage Dockerfiles allow you to write separate Dockerfiles into one file
ENVvariables are not passed between stages From Using Multi-Stage Builds to Simplify And Standardize Build Processes | by Sven Hans Knecht | Capital One Tech | Medium
Best Practises
- Use
COPYoverADD - Two ways to specify a
CMD- Exec Form:
CMD ["executable", "param1", "param2"]- variables cannot be used
- Shell Form:
CMD command param1 param2- variables can be used, but Signals are sent to the invoking shell, not to the app
CMD execcan be used to give enable passing down signals to the following command
- Exec Form:
- You can use a Dockerfile as your CI container Containerized development with NestJS and Docker - LogRocket Blog
- Create a volume for any folder that is written to
- Assign group
rootto any created user (Because Kubernetes gives this group access for all created volumes)- Also, Kubernetes apparently works better with ids rather than user names
- Any kind of modification of a file will create another copy. (i.e when you
chowna file)- the
COPYfile has an--chownargument
- the
- Disable package manager cache when installing stuff ()