Repository: UKGovernmentBEIS/inspect_ai
Issue: `RuntimeError: Failed to build docker containers` is not useful
Root cause: Validation Gap

When the sandbox docker file fails to build, there is no log, no indication of what docker command was run, and no indication of why docker failed

It may be that the Python stack trace is obscuring the output that has more diagnostics (when we run Docker build we allow all stdout/stderr to flow directly into the terminal so you can see both progress and error diagnostics). Here is what I used to try to repro the error: https://gist.github.com/jjallaire-aisi/160f3027c21be54f04a7741ecca7944c

Here is what was printed to the console (note that you have to scroll back quite a bit to see the Docker build failure but it is there):

```
[+] Building 0.4s (5/5) FINISHED                                                     docker:default
 => [default internal] load build definition from Dockerfile                                   0.0s
 => => transferring dockerfile: 80B                                                            0.0s
 => [default internal] load metadata for docker.io/library/python:3.12-bookworm                0.0s
 => [default internal] load .dockerignore                                                      0.0s
 => => transferring context: 2B                                                                0.0s
 => CACHED [default 1/2] FROM docker.io/library/python:3.12-bookworm                           0.0s
 => ERROR [default 2/2] RUN non-existent                                                       0.3s
------                                                                                              
 > [default 2/2] RUN non-existent:
0.263 /bin/sh: 1: non-existent: not found
------
failed to solve: process "/bin/sh -c non-existent" did not complete successfully: exit code: 127
Traceback (most recent call last):
  File "/home/ubuntu/UKGovernmentBEIS/inspect_ai/.venv/bin/inspect", line 8, in <module>
    sys.exit(main())
  File "/home/ubuntu/UKGovernmentBEIS/inspect_ai/src/inspect_ai/_cli/main.py", line 52, in main
    inspect(auto_envvar_prefix="INSPECT")
  File "/home/ubuntu/UKGovernmentBEIS/inspect_ai/.venv/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/ubuntu/UKGovernmentBEIS/inspect_ai/.venv/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/ubuntu/UKGovernmentBEIS/inspect_ai/.venv/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ubuntu/UKGovernmentBEIS/inspect_ai/.venv/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ubuntu/UKGovernmentBEIS/inspect_ai/.venv/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/ubuntu/UKGovernmentBEIS/inspect_ai/src/inspect_ai/_cli/common.py", line 31, in wrapper
    return cast(click.Context, func(*args, **kwargs))
  File "/home/ubuntu/UKGovernmentBEIS/inspect_ai/src/inspect_ai/_cli/common.py", line 63, in wrapper
    return cast(click.Context, func(*args, **kwargs))
  File "/home/ubuntu/UKGovernmentBEIS/inspect_ai/src/inspect_ai/_cli/eval.py", line 305, in wrapper
    return cast(click.Context, func(*args, **kwargs))
  File "/home/ubuntu/UKGovernmentBEIS/inspect_ai/src/inspect_ai/_cli/eval.py", line 367, in eval_command
    eval_exec(
  File "/home/ubuntu/UKGovernmentBEIS/inspect_ai/src/inspect_ai/_cli/eval.py", line 644, in eval_exec
    eval(**params)
  File "/home/ubuntu/UKGovernmentBEIS/inspect_ai/src/inspect_ai/_eval/eval.py", line 113, in eval
    return asyncio.run(
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/ubuntu/UKGovernmentBEIS/inspect_ai/src/inspect_ai/_eval/eval.py", line 292, in eval_async
    await eval_run(
  File "/home/ubuntu/UKGovernmentBEIS/inspect_ai/src/inspect_ai/_eval/run.py", line 69, in eval_run
    shutdown_sandbox_environments = await startup_sandbox_environments(
  File "/home/ubuntu/UKGovernmentBEIS/inspect_ai/src/inspect_ai/_eval/run.py", line 321, in startup_sandbox_environments
    await task_init("startup", sandboxenv[1])
  File "/home/ubuntu/UKGovernmentBEIS/inspect_ai/src/inspect_ai/util/_sandbox/docker/docker.py", line 85, in task_init
    raise ex
  File "/home/ubuntu/UKGovernmentBEIS/inspect_ai/src/inspect_ai/util/_sandbox/docker/docker.py", line 61, in task_init
    await compose_build(project)
  File "/home/ubuntu/UKGovernmentBEIS/inspect_ai/src/inspect_ai/util/_sandbox/docker/compose.py", line 113, in compose_build
    raise RuntimeError(msg)
RuntimeError: Failed to build docker containers
```

We have a special `PrerequisiteError` that hides the stack trace (generally used when optional package dependencies aren't satisfied). I updated the docker build failure exception to use this (https://github.com/UKGovernmentBEIS/inspect_ai/pull/511) which should hopefully resolve this issue. That said, if you are hitting a circumstance where the error diagnostics _are not_ accessible by scrolling up let me know along with details on how to repro and I will address accordingly.

The Docker build diagnostics should be more legible with this PR: https://github.com/UKGovernmentBEIS/inspect_ai/pull/511