Files
docker-cli/cli/command
Sebastiaan van Stijn e6ebaf55dd Fix --network-add adding duplicate networks
When adding a network using `docker service update --network-add`,
the new network was added by _name_.

Existing entries in a service spec are listed by network ID, which
resulted in the CLI not detecting duplicate entries for the same
network.

This patch changes the behavior to always use the network-ID,
so that duplicate entries are correctly caught.

Before this change;

    $ docker network create -d overlay foo
    $ docker service create --name=test --network=foo nginx:alpine
    $ docker service update --network-add foo test
    $ docker service inspect --format '{{ json .Spec.TaskTemplate.Networks}}' test
    [
      {
        "Target": "9ot0ieagg5xv1gxd85m7y33eq"
      },
      {
        "Target": "9ot0ieagg5xv1gxd85m7y33eq"
      }
    ]

After this change:

    $ docker network create -d overlay foo
    $ docker service create --name=test --network=foo nginx:alpine
    $ docker service update --network-add foo test
    service is already attached to network foo

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-01-09 20:42:09 +01:00
..
2017-04-17 17:40:59 -04:00
2017-10-25 14:49:26 -04:00
2017-09-01 19:41:06 -04:00
2017-10-25 14:49:26 -04:00
2017-10-26 12:21:02 -04:00
2017-08-23 01:37:54 +03:00
2017-10-25 14:49:26 -04:00
2018-01-03 10:23:32 +01:00
2018-01-03 10:23:32 +01:00
2017-09-01 19:41:06 -04:00
2017-05-03 18:41:19 -07:00
2018-01-03 10:23:32 +01:00
2017-09-01 19:41:06 -04:00
2017-05-03 18:41:19 -07:00