Docker Stack Deploy error when using `depends_on` long syntax
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 2.2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
Description
Description
Given the following dummy docker-compose.yml
version: '3.9'
services:
serviceA:
image: serviceA:version1
serviceB:
image: serviceB:version2
depends_on:
serviceA:
condition: service_completed_successfully
where serviceB finishes once run (in my real world example, it's a container that runs migrations on a database then dies)
The docker compose up command doesn't complain, however, the docker stack deploy command complains by saying that
services.serviceB.depends_on must be a list
I've tried running docker compose up and it doesn't complain about that, so I assume it works for docker compose up but not for docker stack deploy
Documentation regarding long syntax of depends_on can be found here
https://docs.docker.com/compose/compose-file/#long-syntax-1
Reproduce
- Create the
docker-compose.ymlfile I showed - Execute
docker stack deploy --compose-file docker-compose.yml example-stack
Expected behavior
The stack should start creating. With the example file I provided, it should complain that image serviceA doesn't exist because it's an example, but with real world images it should work and start the stack. However, what actually ends up happening is the error i stated above about the depends on not being a list.
docker version
Client: Docker Engine - Community
Version: 20.10.9
API version: 1.41
Go version: go1.16.8
Git commit: c2ea9bc
Built: Mon Oct 4 16:08:29 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.9
API version: 1.41 (minimum version 1.12)
Go version: go1.16.8
Git commit: 79ea9d3
Built: Mon Oct 4 16:06:37 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.8
GitCommit: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0
docker info
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.6.3-docker)
compose: Docker Compose (Docker Inc., v2.6.0)
scan: Docker Scan (Docker Inc., v0.9.0)
Server:
Containers: 3
Running: 1
Paused: 0
Stopped: 2
Images: 20
Server Version: 20.10.9
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: active
NodeID: olm6j3as729ahukyet1j199mj
Is Manager: true
ClusterID: oj0ovckoc67ev73rqj093a052
Managers: 1
Nodes: 1
Default Address Pool: 10.0.0.0/8
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.0.0.76
Manager Addresses:
10.0.0.76:2377
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc version: v1.1.4-0-g5fd4c4d
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 5.4.0-132-generic
Operating System: Linux Mint 20.3
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 31.29GiB
Name: worklaptop
ID: OVQD:AGQF:NNW2:HPOW:4DNN:CDIK:JKYR:4DSN:YDJX:7XFJ:XJSR:JTXB
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support
Additional Info
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the provided docker-compose.yml and the docker stack deploy --compose-file command. Trace how the stack command validates the long-form depends_on value, then add or update coverage for this example; done means the command no longer rejects the mapping solely because it is not a list.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- cli, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100