X Tutup
Skip to content

Docker stack not scaling to 0 on overridden yml #3293

@AngeloDelgado

Description

@AngeloDelgado

ln order to deploy our services over docker swarm we use 2 different yml files : the base one and the customized one
Here it is an example of our base.yml file:

version: '3.6'
services:
    hello-server-api:
      image: hello-server
      environment:
        - ID=1
      deploy:
        mode: replicated
        replicas: 1
        update_config:
          delay: 50s
        restart_policy:
          condition: on-failure
          max_attempts: 3

Here it is an example of our customized.yml file:

version: '3.6'
services:
    hello-server-api:
      deploy:
        mode: replicated
        replicas: 0
        update_config:
          delay: 50s
        restart_policy:
          condition: on-failure
          max_attempts: 3

we use the customized yml file to manage variables from production and the number of replicas of each container.

docker command to deploy:

docker stack deploy -c base.yml -c customized.yml server

This approach on docker-ce 19.03.11 was working correctly, in fact, the docker service is always deployed 0/0.

Upgrading the docker-ce version to 20.10.0 (we also tried 20.10.8) the behavior is changed and the replicas are always 1/1, it seems like it is not possible to set 0 in the customized.yml file.

However, if we put replicas: 2 in the base.yml and replicas: 1 in the customized.yml it is working correctly (it is working properly in every increasing and decreasing scenario, except when 0 value is used in the customized one ).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup