Skip to content

Include the build output when an image build fails #1508

Open

Description

@cristianrgreco

What happens

When GenericContainer.fromDockerfile(...).build() fails, for example because a RUN step exits non-zero, the error is:

Failed to build image

The build output is only written to the testcontainers:build debug log, so the failing step is invisible unless the run is repeated with DEBUG=testcontainers*.

Expected

The thrown error includes the failing step's output, or the last lines of the build output.

Where

  • packages/testcontainers/src/container-runtime/clients/image/docker-image-client.ts sends build output to the build log only.
  • packages/testcontainers/src/generic-container/generic-container-builder.ts throws Failed to build image when the image doesn't exist after the build.

Notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions