concept config object in category docker

appears as: config objects, config object, config object
Learn Docker in a Month of Lunches

This is an excerpt from Manning's book Learn Docker in a Month of Lunches.

Figure 13.4 Applying configuration from the platform; Swarm mode uses config objects and secrets.
# create the config object from a local JSON file:
 docker config create todo-list-config ./todo-list/configs/config.json
 
 # check the configs in the cluster:
 docker config ls

Config objects are created with a name and the path to the config file contents. This app uses JSON, but config objects can store any type of data--XML, key/value pairs, or even binary files. The Swarm delivers the config object as a file in the container’s filesystem, so the application sees the exact same data you uploaded. Figure 13.5 shows my output--the config object is created with a long random ID in addition to the name.

Figure 13.5 Loading a local file into the Swarm cluster as a config object

You work with config objects like other Docker resources--there are commands to remove and inspect them as well as to create them. Inspection is useful because it shows you the contents of the config file. That’s an important point about config objects: they’re not meant for sensitive data. The file content is not encrypted in the Swarm database, nor is it encrypted in transit as it moves from the managers to the nodes that are running the replicas.