-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Description
For 1.13 and later, I would like to suggest supporting "indexed jobs" in docker service create.
There has been a similar proposal in the Kubernetes community (seems not implemented yet)
https://github.com/kubernetes/kubernetes/blob/v1.3.0-beta.2/docs/design/indexed-job.md
Example:
$ echo "apple banana cherry" > fruits.txt
$ echo "green yellow red" > colors.txt
$ kubectl run say-fruit --image=busybox \
--per-completion-env=FRUIT="$(cat fruits.txt)" \
--per-completion-env=COLOR="$(cat colors.txt)" \
-- \
sh -c 'echo "Have a nice $COLOR $FRUIT" && sleep 5'
(pod0) Have a nice green apple
(pod1) Have a nice yellow banana
(pod2) Have a nice red cherryThe corresponding command line for docker service will be like this:
$ docker service create --replicas 3 --name say-fruit \
--per-completion-env=FRUIT="$(cat fruits.txt)" \
--per-completion-env=COLOR="$(cat colors.txt)" \
--restart-condition=on_failure
busybox
'echo "Have a nice $COLOR $FRUIT" && sleep 5' (I feel the name of --per-completion-env is too long and unclear.. I prefer something else like --scatter)
I would like to hear thoughts from maintainers about having this feature.
I think we need docker service exec and perhaps docker service cp as well for taking advantage of the feature.
I believe the feature can be also used for effectively executing test-integration-cli in parallel across multiple Docker machines.
So there will be significant benefit for developers 😃