Tmp2

From NovaOrdis Knowledge Base
Revision as of 06:58, 5 December 2017 by Ovidiu (talk | contribs) (→‎Image)
Jump to navigation Jump to search

tmp2

Docker and State Management

Environment Variables

Containerized applications must avoid maintaining configuration in filesystem files - if they do, it limits the reusability of the container. A common pattern used to handle application configuration is to move configuration state into environment variables that can be passed to the application from the container. Docker supports environment variables natively, they are stored in the metadata that makes up a container configuration, and restarting the container will ensure the same configuration is passed to the application each time.

Storing Files

Storing state into the container's filesystem will not perform well. The space is extremely limited and the state will not be preserved across the container lifecycle.

Application State

The best use case for Docker is an application that can store state in a centralized location that could be accessed regardless of which host the container runs on.


Layer

Layered Image

Each set of new changes made during the container build process is laid in top of previous changes. In general, each individual build step used to create the image corresponds to one filesystem layer. Each layer is identified by an unique long hexadecimal number named hash. The hash is usually shortened to 12 digits. If a shared image is updated, all containers that use it must be re-created.

The layers are version controlled.