New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Why does compose up
always recreate one-shot containers?
#11808
Comments
Compose expect a service to be a "long running process", and as such
compose does not have support for "init containers" (one-shot containers as you name them) that would support such a lifecycle, where the |
I see. Thank you. Should we keep this issue open as a feature request then? |
Closing until we get better support for init containers, see compose-spec/compose-spec#291 |
I just don't understand why a full-blown new syntax would be required. Can't the issue I'm reporting be fixed more simpler way? I think docker compose only needs to remember whether the service last exited successfully or not, and then re-run or not based on this + whether the service definition changed or not. |
this would require a change in the existing behavior that would have impacts for other users |
Maybe this is the kind of behavior change that everyone would appreciate receiving? lol |
Description
Let's start small:
Now run:
It will start the service and exit once healthy.
Now run the same command again:
It will NOT re-create the service, because nothing changed, and therefore the service didn't need to be recreated. This is great!
Now, let's add a one-shot container to the mix:
And let's:
All good so far. Let's try again:
And as you can notice by the time taken, the
script
was recreated. Because of this, it did not finish fast.In my opinion this is not the proper behavior. Since
condition: service_completed_successfully
, I was expecting the one-shot service not to be recreated if it had last completed succesfully and nothing was changed in the compose configuration.At least for some of my use cases, this causes each
docker compose up
here to take useless 20 minutes to execute even if nothing was changed. So, this is big deal to me. :(Steps To Reproduce
See above.
Compose Version
Docker Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: