moby: Service contraints not being honoured in a swarm
Output of docker version
:
Client:
Version: 1.12.0-rc2
API version: 1.24
Go version: go1.6.2
Git commit: 906eacd
Built: Fri Jun 17 20:45:29 2016
OS/Arch: linux/amd64
Server: Version: 1.12.0-rc2 API version: 1.24 Go version: go1.6.2 Git commit: 906eacd Built: Fri Jun 17 20:45:29 2016 OS/Arch: linux/amd64
Output of docker info
:
Containers: 4
Running: 3
Paused: 0
Stopped: 1
Images: 7
Server Version: 1.12.0-rc2
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 47
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: host null bridge overlay
Swarm: active
NodeID: 8ptf9fd6phpss2qy15a5c6frm
IsManager: Yes
Managers: 1
Nodes: 3
CACertHash: sha256:255d696a217a06801576ddf2a19f2b38487d007c6b470e545bf659e170a969ad
Runtimes: default
Default Runtime: default
Security Options: apparmor seccomp
Kernel Version: 4.4.0-28-generic
Operating System: Ubuntu 16.04 LTS
OSType: linux
Architecture: x86_64
CPUs: 32
Total Memory: 251.9 GiB
Name: xxxx
ID: …
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Insecure Registries:
127.0.0.0/8
Additional environment details (AWS, VirtualBox, physical, etc.): Installed docker on fresh Ubuntu-16 baremetal boxes.
Steps to reproduce the issue:
- On node 1 - create a swarm: swarm init
- On node 2 - update /etc/systemd/system/docker.service file with label: ExecStart=/usr/local/bin/dockerd -H fd:// --label foo=“bar”
- On node 2 - Restart daemon
- On node 2 - verify label has taken: $ docker -D info … Labels: foo=bar …
- On node 2- join swarm: $ d swarm join XXX:2377
- On node 1- create service with constraint: $ docker service create --constraint foo=“bar” --name testconstraint --replicas 5 -p 8889:80 httpd:2.4
Describe the results you received: 7. On node 1- verify new service is running on node 1: $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 7e52cca2ec86 httpd:2.4 “httpd-foreground” About a minute ago Up 58 seconds 80/tcp testconstraint.2.1t257nejusprq9toos441a1ah 0f0d75d2057d httpd:2.4 “httpd-foreground” About a minute ago Up 57 seconds 80/tcp testconstraint.4.2jujh8pg5pl2t3cgb0109kl33
Describe the results you expected:
I was expecting the service to only run on node 2, where the label was applied to the daemon.
Additional information you deem important (e.g. issue happens only occasionally):
I’ve tried this with variations of the label like: –constraint foo=bar, --constraint foo==bar with no luck. Happens consistently.
Am I creating the label in the engine incorrectly?
thanks
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 21 (16 by maintainers)
I can verify a similar issue with docker 1.12 rc3:
docker service create --constraint node=worker1 --replicas 5 --name hello alpine ping docker.com
Results in empty node value when running docker service tasks hello.
Tried with name, node, id, hostname with same result… also node.hostname etc.
And the form --constraint node.hostname=“worker1” makes the service be spread out on all nodes.
Don’t know if docker/swarmkit#893 was included in rc3?