-
Notifications
You must be signed in to change notification settings - Fork 122
Remove the container in case of detach mode #435
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
Conversation
Signed-off-by: Milan Balazs <milanbalazs01@gmail.com>
|
These options should be sent to the server, to tell it to remove the container when it is finished, I don't think it is needs to be done on the client side? |
I agree that would be an elegant solution, but based on the API documentation the described options are not implemented on server side (API): Currently the podman-py/podman/domain/containers.py Lines 388 to 398 in da8fca9
In my opinion, if you would like to pass these parameters to server side (via API), then some changes are needed on server side as well (at least in the API component). If it's enough to solve this issue on the client side, then my PR can solve it. It's up to you. :) |
|
OK |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: inknos, milanbalazs The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…708 (#1248) We were creating the container with "remove=True". This was due to the first design where we had a worker attached to the container and we relied on podman to get deleted the container once it is stopped. We found that this parameter did not work properly in the podman client, so we added a cleanup logic anyway. After the refactor of activations, this was never needed, since we fetch the logs in the monitor after stop the container, before remove it. Now after the upgrade of the podman client, this [has been fixed ](containers/podman-py#435 the container is actually removed when it is stopped. Our cleanup logic run under a conditional "if container.exists()" so we can incur in race conditions since there is a time window between podman stops the container and it is get deleted, then, we can enter in the conditional and later raises an exception because the container was deleted in the meantime. Even in the successful case (we don't enter in the condition) now the container gets deleted once it is stopped there is a potential loss of the last output not gathered by the monitor. 1. Remove nested try/except block, it is a bug because NotFound exception is also an ApiError exception. 2. Don't create the container with "remove=True" 3. Consolidate log level messages to warning. Jira: https://issues.redhat.com/browse/AAP-42708 Signed-off-by: Alex <aizquier@redhat.com>
Currently if the
detach=Trueandremove=Trueparameters are specified in the same command, the container is not deleted.Reproduce the issue:
With this change if the above parameters are provided then the container object is returned and the container removing (wait method is included) is started on a separated thread.
Fix for: