Search code examples
dockerdocker-swarmdocker-stack

docker stack - commit changes of docker-compose.yml


I wanted to change the placement (manager/worker) of several containers in my docker stack deployment (swarm). Now im asking myself how i can commit the changes of my docker-compose.yml file to the deployed stack as I changed/extended the following:

deploy:
      ...
      placement:
        constraints:
          - node.role == worker

I already checked the docker docs on this but I found nothing according to this so far.

Thanks


Solution

  • After changing your docker-compose.yml, you can run another docker stack deploy -c docker-compose.yml ... to the same stack name and docker will update the new target state. And with that new target state, swarm mode will perform the changes to the services.