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
Sometimes a container get stuck in restarting mode #20400
Comments
This looks like expected behavior; if there's a restart-policy set on the container, the docker daemon will attempt to restart the container if it exits, and if there's no "max-retries" set, it will keep trying to restart the container each time it exits. |
hi @michipili Could that contianer be removed with force option? |
@thaJeztah There is no indication that the container is actually restarted and exited. As far as I can tell, the program in the container does not start. We see no application logs, no log output. In other cases where a restart policy causes a “restart-exit loop”, @HackToday The affected containers could be stopped and removed without using any forcing flag. |
/CC @fredpe |
I am also seeing this issue:
Any advice? Is a workaround known at this time? |
For my case, the containers can vary in execution time, sometimes less than a 2-3 seconds. |
Looking at the docker logs redirected me to #17653 going to give the workaround a shot #17653 (comment) |
@jpcope the "restart" timer is reset after a container has been running for 10 seconds, if it exits before that time, the duration between restarts is incremented with each restart. the "restarting" status, basically is "wait for the next restart attempt", and that can grow rapidly. If you have containers that only need to run for a short time, and be started with a certain interval, something like a cron-job to start those containers may be a better solution than setting a restart-policy |
@thaJeztah Thank you :-) When I found this in the manual I did just that. Thanks for following up as I was experiencing both this and the issue in #17653 |
First check the logs why the container failed. Because your restart policy might bring your container back to running status. Better to fix the issue, Then probably you can build a new image with/without fix. Later execute below command docker system prune https://forums.docker.com/t/docker-registry-in-restarting-1-status-forever/12717/3 |
These containers still can be stopped and removed.
The condition ist not perfectly reproducible. These containers are run with a memory limit set
--memory=1318m
and the condition seems to occur only after that the container has been killed because of excessing this memory limit.The text was updated successfully, but these errors were encountered: