If I have a docker service A with a .yml file for configuration and I replicate this service to 5 instances, is there a way for me to have a slightly different config for each replicated instance of the service? for .eg just one parameter is different across these instances of the service.
When you add a config to the swarm, Docker sends the config to the swarm manager over a mutual TLS connection. The config is stored in the Raft log, which is encrypted. The entire Raft log is replicated across the other managers, ensuring the same high availability guarantees for configs as for the rest of the swarm management data.
When you grant a newly-created or running service access to a config, the config is mounted as a file in the container. The location of the mount point within the container defaults to / in Linux containers. In Windows containers, configs are all mounted into C:\ProgramData\Docker\configs and symbolic links are created to the desired location, which defaults to C:<config-name>.
You can set the ownership (uid and gid) for the config, using either the numerical ID or the name of the user or group. You can also specify the file permissions (mode). These settings are ignored for Windows containers.
If not set, the config is owned by the user running the container command (often root) and that user’s default group (also often root).
If not set, the config has world-readable permissions (mode 0444), unless a umask is set within the container, in which case the mode is impacted by that umask value.
You can update a service to grant it access to additional configs or revoke its access to a given config at any time.
A node only has access to configs if the node is a swarm manager or if it is running service tasks which have been granted access to the config. When a container task stops running, the configs shared to it are unmounted from the in-memory filesystem for that container and flushed from the node’s memory.
If a node loses connectivity to the swarm while it is running a task container with access to a config, the task container still has access to its configs, but cannot receive updates until the node reconnects to the swarm.
You can add or inspect an individual config at any time, or list all configs. You cannot remove a config that a running service is using. See Rotate a config for a way to remove a config without disrupting running services.
To update or roll back configs more easily, consider adding a version number or date to the config name. This is made easier by the ability to control the mount point of the config within a given container.
To update a stack, make changes to your Compose file, then re-run docker stack deploy -c . If you use a new config in that file, your services start using them. Keep in mind that configurations are immutable, so you can’t change the file for an existing service. Instead, you create a new config to use a different file
You can run docker stack rm to stop the app and take down the stack. This removes any config that was created by docker stack deploy with the same stack name. This removes all configs, including those not referenced by services and those remaining after a docker service update --config-rm.