When setting DockerOperator with auto_remove=True in airflow version 2.0.0 the container remain in the container list if it was finished with 'Exited (1)'
tests/providers/docker/operators/test_docker.py
# C
        operator = DockerOperator(image='publicregistry/someimage', owner='unittest', task_id='unittest')
        # M
        hook_mock = mock.Mock(name='DockerHook mock', spec=DockerHook)
        hook_mock.get_conn.return_value = self.client_mock
        operator.get_hook = mock.Mock(
            name='DockerOperator.get_hook mock', spec=DockerOperator.get_hook, return_value=hook_mock
        )
        operator.execute(None)
        assert operator.get_hook.call_count == 0, 'Hook called though no docker_conn_id configured'
    @mock.patch('airflow.providers.docker.operators.docker.DockerHook')
    def test_execute_with_docker_conn_id_use_hook(self, hook_class_mock):
        # C
        operator = DockerOperator(
            image='publicregistry/someimage',
            owner='unittest',
            task_id='unittest',
            docker_conn_id='some_conn_id',
        )
        # M
        hook_mock = mock.Mock(name='DockerHook mock', spec=DockerHook)
        hook_mock.get_conn.return_value = self.client_mock
        hook_class_mock.return_value = hook_mock
        operator.execute(None)
        assert self.client_class_mock.call_count == 0, 'Client was called on the operator instead of the hook'
        assert hook_class_mock.call_count == 1, 'Hook was not called although docker_conn_id configured'
        assert self.client_mock.pull.call_count == 1, 'Image was not pulled using operator client'
    def test_execute_xcom_behavior(self):