moby: docker stack deploy doesn't allow you to deploy individual services
Description
When using docker stack deploy against a docker-compose.yml file, you are unable to update a single service. With docker-compose you can specify the service you want to update but docker stack deploy doesn’t have this option and simply replaces the whole stack each time.
Steps to reproduce the issue:
- Create a docker-compose.yml file containing multiple services.
- Run
docker stack deploy --compose-file docker-compose.yml
Describe the results you received:
Unable to update an individual service.
Describe the results you expected:
Similarly to with docker-compose, I’d expect to be able to deploy individual services.
Additional information you deem important (e.g. issue happens only occasionally):
Output of docker version:
Client:
Version: 1.13.0-rc7
API version: 1.25
Go version: go1.7.3
Git commit: 48a9e53
Built: Fri Jan 13 06:52:01 2017
OS/Arch: linux/amd64
Server:
Version: 1.13.0-rc7
API version: 1.25 (minimum version 1.12)
Go version: go1.7.3
Git commit: 48a9e53
Built: Fri Jan 13 06:52:01 2017
OS/Arch: linux/amd64
Experimental: false
Output of docker info:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 4
Server Version: 1.13.0-rc7
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 40
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Swarm: active
NodeID: koz4efugm4ez6botqx48l1uzt
Is Manager: true
ClusterID: rshk2pdetaz31lmj5bkhvaqod
Managers: 3
Nodes: 6
Orchestration:
Task History Retention Limit: 5
Raft:
Snapshot Interval: 10000
Number of Old Snapshots to Retain: 0
Heartbeat Tick: 1
Election Tick: 3
Dispatcher:
Heartbeat Period: 5 seconds
CA Configuration:
Expiry Duration: 3 months
Node Address: 172.21.0.68
Manager Addresses:
172.21.0.68:2377
172.21.0.70:2377
172.21.0.71:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 03e5862ec0d8d3b3f750e19fca3ee367e13c090e
runc version: 2f7393a47307a16f8cee44a37b262e8b81021e3e
init version: 949e6fa
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.4.0-47-generic
Operating System: Ubuntu 16.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 3.359 GiB
Name: hidden
ID: 7JZL:TX5S:6FEL:D556:AJML:Y45S:QTKA:UFWD:3HES:QPMD:KLF4:SD2P
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: hidden
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Labels:
provider=generic
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Additional environment details (AWS, VirtualBox, physical, etc.):
Microsoft Azure VM
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Reactions: 17
- Comments: 16 (4 by maintainers)
My stack is already up to date, and I’ve changed one service. I want to deploy the change, but have to sit around twiddling my thumbs while I wait for it to check 30+ other services to discover nothing is new there. It would be really handy to say ‘this is the service that’s changed, just do that’. Iterative development becomes real slow otherwise.
There’s also no feedback as to whether a service has been changed by the deploy or not, so if I’m working in prod I feel obliged to keep an eye on all the services after each deploy in case something unexpected has happened.
You can use docker service update (optionally with force flag).
oneliner:
I sometimes scale individual services when later registering new services in the config file. I don’t want
deployto change update those services, only the new ones. So, i second this.@dnephin I really think you should reconsider that statement. I do see your point that a stack is a “state definition” and that
docker stackwill attempt to do whatever it takes to reach that state. However, in reality and in larger companies, there are SLAs and accountability to take into account. We can’t have a change in a little small service potentially affect ALL other services because the Stack somehow decides to update all services. Due to a bug or due to another developer has unintentionally changed something in the stack configuration.There needs to be a way to deploy a single service in a stack. Not only update. Deploy.
I guess another option is to have one compose file per service but that doesn’t feel semantically correct.
This is insanely frustrating for me, I’d like to stop and start a single service at a time using the same config (mem limits etc.) as in my massive compose file, now I have to split each service into its own compose file 😢
I’d like to avoid that feature. It leads to a lot of unexpected results and confusing behaviour. It only existed in
docker-composebecause older versions didn’t support diffing config to determine which services had changed. More recent versions perform this check, so attempting to update only one service at a time isn’t necessary anymore.As @cpuguy83 mentioned, swarm handles the diff, so there’s no reason to guess which services have changed.
I think the model is a lot cleaner if we treat the entire compose file as a single atomic unit. This is the direction that we’re going by moving the “stack” concept to be a server-side concept.
The diff is handled by swarm. If nothing changed on the service then nothing is done.