def _collect_container_logs(self):
        """Collect logs from all containers for debugging.

        Returns:
            Dict mapping container IDs to their logs
        """
        os.chdir(self.tests_dir)
        try:
            # Get list of running containers for this project
            cmd = [
                *self.compose_cmd,
                "-f",
                self.compose_file,
                "-p",
                DEFAULT_PROJECT_NAME,
                "ps",
                "-q",
            ]
            result = subprocess.run(cmd, capture_output=True, text=True, check=True)
            container_ids = [cid for cid in result.stdout.strip().split("\n") if cid]

            if not container_ids:
                return {}

            # Collect logs for each container
            logs = {}
            for cid in container_ids:
                if not cid:
                    continue
                try:
                    log_cmd = ["docker", "logs", cid]
                    log_result = subprocess.run(log_cmd, capture_output=True, text=True, check=True)
                    logs[cid] = log_result.stdout
                except subprocess.CalledProcessError:
                    logs[cid] = "Failed to collect logs"

            return logs
        except Exception as e:
            logger.error(f"Error collecting container logs: {e}")
            return {}
        finally:
            os.chdir(self.cwd)
Collect logs from all containers for debugging.

        Returns:
            Dict mapping container IDs to their logs
        
backend/tests/helpers/docker.py