Skip to content

docker service update --host-add does not support list of hosts, though documentation specifies it does #50769

@zdenkers

Description

@zdenkers

Description

docker service update --host-add host1:192.168.1.111,host2:192.168.1.222 my_service returns an invalid argument error 'invalid argument "host1:192.168.1.111,host2:192.168.1.222" for "--host-add" flag: invalid IP address in add-host: "192.168.1.111,host2:192.168.1.222"

It should probably behave the same way as --host-rm since "docker service update --host-rm host1:192.168.1.111,host2:192.168.1.222" my_service does work.

This enables the workflow of updating existing set host ips with "--host-rm host1:192.168.1.111,host2:192.168.1.222 --host-add host1:192.168.1.112,host2:192.168.1.223"

Reproduce

docker service update --host-add host1:192.168.1.111,host2:192.168.1.222 my_service

Expected behavior

docker service update should add the list of hosts to the hosts list for the service

docker version

Client: Docker Engine - Community
 Version:           28.3.2
 API version:       1.51
 Go version:        go1.24.5
 Git commit:        578ccf6
 Built:             Wed Jul  9 16:13:45 2025
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          28.3.2
  API version:      1.51 (minimum version 1.24)
  Go version:       go1.24.5
  Git commit:       e77ff99
  Built:            Wed Jul  9 16:13:45 2025
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.27
  GitCommit:        05044ec0a9a75232cad458027ca83437aae3f4da
 runc:
  Version:          1.2.5
  GitCommit:        v1.2.5-0-g59923ef
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client: Docker Engine - Community
 Version:    28.3.2
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.25.0
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.38.2
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 51
  Running: 25
  Paused: 0
  Stopped: 26
 Images: 25
 Server Version: 28.3.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: active
  NodeID: hkaj4s6xt83wlf3h0xy052a51
  Is Manager: true
  ClusterID: n3w51dj9khz3bdglprioou3x5
  Managers: 3
  Nodes: 3
  Default Address Pool: 172.20.0.0/14
  SubnetSize: 24
  Data Path Port: 4789
  Orchestration:
   Task History Retention Limit: 5
  Raft:
   Snapshot Interval: 10000
   Number of Old Snapshots to Retain: 0
   Heartbeat Tick: 1
   Election Tick: 10
  Dispatcher:
   Heartbeat Period: 5 seconds
  CA Configuration:
   Expiry Duration: 3 months
   Force Rotate: 0
  Autolock Managers: false
  Root Rotation In Progress: false
  Node Address: 10.17.24.10
  Manager Addresses:
   10.17.24.10:2377
   10.17.24.11:2377
   10.17.24.12:2377
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 05044ec0a9a75232cad458027ca83437aae3f4da
 runc version: v1.2.5-0-g59923ef
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.8.0-71-generic
 Operating System: Ubuntu 24.04.2 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 78.45GiB
 Name: dfw-web-docker-01
 ID: 1760dcfe-72e8-466c-95cf-336563508cb8
 Docker Root Dir: /mnt/docker/data
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false
 Default Address Pools:
   Base: 172.16.0.0/14, Size: 22

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugBugs are bugs. The cause may or may not be known at triage time so debugging may be needed.status/0-triage

    Type

    No type

    Projects

    Status

    New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions