Docker Dockerfile

Best Practises

  • Use COPY over ADD
  • 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 exec can be used to give enable passing down signals to the following command
  • 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 root to 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 chown a file)
    • the COPY file has an --chown argument
  • Disable package manager cache when installing stuff ()