Open ben-davis opened 3 years ago
We're running into the same problem. Given that this seems like it's the only proper way to run DB migrations, it's surprising to see that no one else has chimed in after a year and a half.
@ben-davis Did you ever land on a solution or workaround?
I also have a problem with db-migrations, unfortunally you can not be sure that swarm will execute only one task. see: https://github.com/moby/moby/issues/42789
https://github.com/moby/moby/issues/42741#issuecomment-1229449280
https://github.com/moby/moby/issues/42742#issuecomment-1229449246
I can confirm CLI hang in Docker 24:
# docker service create --mode=replicated-job --restart-max-attempts=0 --replicas=1 --restart-condition=none --name=test bash "exit 1"
kj6pwo0rverbvq2plz9mt5ef4
job progress: 0 out of 1 complete [> ]
active tasks: 0 out of 1 tasks
1/1: task: non-zero exit (127)
...
Can confirm the same issue
Docker version 24.0.5, build ced0996
We're running into the same problem. Given that this seems like it's the only proper way to run DB migrations, it's surprising to see that no one else has chimed in after a year and a half.
@ben-davis Did you ever land on a solution or workaround?
I also have the same problem. I use command timeout or analogs for workaround:
timeout 60s docker service create [OPTIONS] IMAGE [COMMAND] [ARG...]
Description When creating a
replicated-job
service, if the task fails with--restart-condition=none
, whenTotalCompletions
has been reached the CLI hangs. As neitherupdate_config
orrollback_config
can be set, it doesn't seem possible to control what Docker should do.I'm using a
replicated-job
to run a migration during a deploy pipeline and ideally when all tasks have failed to converge, thedocker service create|update
would exit with an error.Steps to reproduce the issue:
docker service create --mode=replicated-job --replicas=1 --restart-condition=none bash "exit 1"
Describe the results you received: The CLI command hangs indefinitely.
Describe the results you expected: The CLI command to exit as it's reached its limit to attempt any more restarts of the tasks.
Output of
docker version
:Output of
docker info
: