Today I learned how to update docker configs on stack deploy. Docker configs are immutable meaning when re-deploying a stack they can not be updated.

The way to update configs on re-deploys is to create a new one each time a docker stack deploy is triggered. And a good way to to that is to template the config name using a unique value like (current system time).

configs:
  settings.yml:
    name: settings-${SETTINGS_TIMESTAMP}.yml
    file: foo.yml

And then running stack deploy.

SETTINGS_TIMESTAMP=$(date +%s) docker stack deploy...

Source