0

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?

1 Answer 1

1

I have built pipeline for kubernetes but not for docker swarm, but it seems like the principles are the same.

The pipelines normally follow this structure in azure devops:

-Build(docker push+publish yml files as artifacts)
  -Release dev(download artifacts)
  -Release uat(download artifacts)
  -Release prod(download artifacts)

Here in each release step you would transform image tag to match the build version. e.g. foo:#{BUILD_NO}# where #{BUILD_NO}# is replaced using an appropiate task for this purpose assuming we tag the docker image with the build no.

2
  • Thanks for your reply! What do you mean when you say "publish yml as artifacts"? Apr 13, 2020 at 10:17
  • It may be too azure devops specific, but it is the way to transfer files from build stages to release stages. Apr 13, 2020 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.