-
Notifications
You must be signed in to change notification settings - Fork 891
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
feat: ignore removal error due to non-existing containers #1481
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Congratulations on opening your first pull request! We'll get back to you as soon as possible. In the meantime, please make sure you've updated the documentation to reflect your changes and have added test automation as needed. Thanks! 🙏🏼
Codecov ReportBase: 64.76% // Head: 66.19% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1481 +/- ##
==========================================
+ Coverage 64.76% 66.19% +1.42%
==========================================
Files 24 24
Lines 2310 2313 +3
==========================================
+ Hits 1496 1531 +35
+ Misses 718 682 -36
- Partials 96 100 +4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Just skipping all container removal sounds a bit inflexible, and only fixes the problem if all containers are set to auto-remove. |
Yes you are right, checking for each container is a better choice. |
Is there anything else you want me to change for the PR to be accepted? |
I mostly haven't had time. Sorry. I will get to reviewing it as soon as I get some spare time. |
Yeah, watchtower already checks for |
…ontainers that were removed by other means (errors of type ErrNotFound). This can be useful when the start of the containers is managed by docker compose or an external system such as systemd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change seems to be the most sane course to take regardless of whether it's caused by the issue this PR attempts to fix.
I added a test for the "normal" case (container still existing after being stopped), as well as one for when the container could not be found.
Awesome :) Thanks a lot for your work on this project! |
@all-contributors add @nothub for code |
I've put up a pull request to add @nothub! 🎉 |
This PR allows watchtower to ignore a failure to remove containers that doesn't exist. This can be useful when the start of the containers is managed by docker compose or an external system such as systemd.
Watchtower causes an issue for me in combination with the
--abort-on-container-exit
flag for dockerscompose up
subcommand.Docker compose removed the container on its own after the container was stopped. This leads to an error when watchtower attempts to remove the container.
Error: No such container: 425173...
The error is thrown by this ContainerRemove call.
Fixes #1480