Docker Container Best Practices: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
Line 19: Line 19:
* Docker.com Dockerfile best practices: https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices
* Docker.com Dockerfile best practices: https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices


=Document Images=
=Best Practices for Creating Images=
{{External|https://docs.openshift.com/container-platform/4.6/openshift_images/create-images.html}}
 
==Document Images==


{{Internal|Docker Methods to Document Images|Methods to Document Images}}
{{Internal|Docker Methods to Document Images|Methods to Document Images}}

Latest revision as of 02:12, 2 January 2021

External

Internal

Overview

Reference

Best Practices for Creating Images

https://docs.openshift.com/container-platform/4.6/openshift_images/create-images.html

Document Images

Methods to Document Images
  • Logging
  • Metrics
  • Storage
  • Operations
  • Upgrades

Java in a Container

Java in a Container

Fail Early

Check the environment configuration and fail early in the ENTRYPOINT script:

 #
 # check the environment and fail early, when the container executed for the first time
 #
/opt/dsmanager/bin/dsmanager check-configuration || { echo "dsmanager configuration error" 1>&2; exit 1; }

/opt/dsmanager/bin/dsmanager check-configuration must exit with a non-zero value if the configuration fails.

Use .dockerignore

Use Multistage Builds

TODO https://docs.docker.com/develop/develop-images/multistage-build/

To Process