docker 1.12 swarm : Does Swarm have a configuration store like kubernetes configMap

8/5/2016

As per kubernetes docs: http://kubernetes.io/docs/user-guide/configmap/

Kubernetes has a ConfigMap API resource which holds key-value pairs of configuration data that can be consumed in pods.

This looks like a very useful feature as many containers require configuration via some combination of config files, and environment variables

Is there a similar feature in docker1.12 swarm ?

-- atv
docker
docker-swarm
kubernetes

1 Answer

8/9/2016

Sadly, Docker (even in 1.12 with swarm mode) does not support the variety of use cases that you could solve with ConfigMaps (also no Secrets).

The only things supported are external env files in both Docker ( https://docs.docker.com/engine/reference/commandline/run/#/set-environment-variables-e-env-env-file) and Compose (https://docs.docker.com/compose/compose-file/#/env-file).

These are good to keep configuration out of the image, but they rely on environment variables, so you cannot just externalize your whole config file (e.g. for use in nginx or Prometheus). Also you cannot update the env file separately from the deployment/service, which is possible with K8s.

Workaround: You could build your configuration files in a way that uses those variables from the env file maybe.

I'd guess sooner or later Docker will add those functionality. Currently, Swarm is still in it's early days so for advanced use cases you'd need to either wait (mid to long term all platforms will have similar features), build your own hack/woraround, or go with K8s, which has that stuff integrated.

Sidenote: For Secrets storage I would recommend Hashicorp's Vault. However, for configuration it might not be the right tool.

-- puja
Source: StackOverflow