Skip to content
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

docker run, add restart option "limited" #47801

Open
pier4r opened this issue May 6, 2024 · 2 comments
Open

docker run, add restart option "limited" #47801

pier4r opened this issue May 6, 2024 · 2 comments
Labels
kind/feature Functionality or other elements that the project doesn't currently have. Features are new and shiny status/0-triage

Comments

@pier4r
Copy link

pier4r commented May 6, 2024

Description

The documentation as today (2024-05-06) is

    --restart=no
    --restart=always
    --restart=on-failure
    --restart=on-failure:3
    --restart=unless-stopped

the restart=on-failure:3 almost covers the request. The on-failure:3 restarts 3 times the container if the container exits with a "bad" status code. Instead sometimes one wants to give a limited number of restarts (and then one needs to investigate) to containers that may exit with a good status code (like exit 0).

Yes I know, the application should be good enough to exit with a proper status code in case of error, but in the real world not all applications exit with proper status codes. Therefore a restart=limited:3 could help in this case.

Hopefully it could be implemented without a major effort. Thank you!

@pier4r pier4r added kind/feature Functionality or other elements that the project doesn't currently have. Features are new and shiny status/0-triage labels May 6, 2024
@thaJeztah
Copy link
Member

So, IIUC, the proposal is effectively to have --restart=always:3 (always restart the container, but maximum 3 times?).

I should add that I'm not sure if we currently want to expand options for restart-policies, as they are already somewhat crossing the line between container runtime and orchestration (and there's some already nasty parts in the current implementation)

@pier4r
Copy link
Author

pier4r commented May 6, 2024

Yes. --restart=always:3 would do it. Because some app crash or exit with a non proper exit code and one wants to restart only so often.

Yes I understand that it goes on the orchestration part. I asked in docker-compose but they, correctly, sent me here. If one uses at most docker-compose as a docker wrapper, which other tool could cover this case without bloating the stack of tools that one needs to use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Functionality or other elements that the project doesn't currently have. Features are new and shiny status/0-triage
Projects
None yet
Development

No branches or pull requests

2 participants