We have a number of "in_container" scripts written in Bash, They are doing a number of houseekeeping stuff but since we already have Python 3.7+ inside the CI image, we could modularise them more and make them run from external and simplify entrypoint_ci (for example separate script for tests).
command_result = run_command(
        cmd,
        text=True,
        check=False,
        env=shell_params.env_variables_for_docker_commands,
        output_outside_the_group=True,
    )
    if command_result.returncode == 0:
        return command_result
    else:
        get_console().print(f"[red]Error {command_result.returncode} returned[/]")
        if get_verbose():
            get_console().print(command_result.stderr)
        return command_result
def is_docker_rootless() -> bool:
    try:
        response = run_command(
            ["docker", "info", "-f", "{{println .SecurityOptions}}"],
            capture_output=True,
            check=False,
            text=True,
        )
        if response.returncode == 0 and "rootless" in response.stdout.strip():
            get_console().print("[info]Docker is running in rootless mode.[/]\n")
            return True
    except FileNotFoundError:
        # we 
        pass
    return False