I need a clarification about the correct process to use a CD to update an environment where a Docker Swarm runs. I understood that I can configure my CD to execute
docker service update --image foo:1.1.0 fooservice inside the Swarm and so having my stack always up to last image.
But I do not understand how to manage my
stack.yml files: I initialize the swarm copying on the machine my stack files which defines the "state of the art" of my services; but when the CD updates the running images, the files become outdated.
Should I replace the service update command with something that modifies the stack files and redeploy? Or is it expected that yml files become obsolete?