Container Image Layer Structure

Container Image Layer Structure An architecture diagram generated by Archify. Application Layer · Application code · Container image (layer stack) · Changes often Application Layer Application code Changes often Dependencies Layer · npm packages, pip packages, etc. · Container image (layer stack) Dependencies Layer npm packages, pip packages, etc. Runtime Layer · Node.js, Python, etc. · Container image (layer stack) Runtime Layer Node.js, Python, etc. OS Layer · Ubuntu, Alpine, etc. · Container image (layer stack) · Shared · cached OS Layer Ubuntu, Alpine, etc. Shared · cached stacked on top of Container image (layer stack) Legend Application code Runtime & dependencies Base image

Image layers

  • • Each layer represents the changes made on top of the previous layer
  • • Layering makes image sharing and caching efficient

Dockerfile

  • • Each Dockerfile instruction adds a new layer to the image
  • • Place frequently changing layers later to leverage the build cache

Container image

  • • An immutable template containing the application and its dependencies