galafis opened a new pull request, #63737: URL: https://github.com/apache/airflow/pull/63737
When a DockerOperator task is killed via the Airflow UI (e.g., "Mark as Failed"), the `on_kill` method only calls `self.cli.stop()` but does not remove the container when `auto_remove='force'` is set. This leaves orphaned containers in a stopped state (`Exited (137)`), causing `409 Conflict` errors on subsequent DAG runs that attempt to create a container with the same name. **Changes:** - After `self.cli.stop()`, check if `self.auto_remove == 'force'` and call `self.cli.remove_container(force=True)` to remove the stopped container - This mirrors the container removal logic already present in the normal execution path (`_run_image_with_mounts`) closes: #56149 --- ##### Was generative AI tooling used to co-author this PR? - [ ] Yes (please specify the tool below) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
