Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support building docker images using BuildKit #571

Open
helmlover opened this issue May 12, 2023 · 4 comments
Open

support building docker images using BuildKit #571

helmlover opened this issue May 12, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@helmlover
Copy link

helmlover commented May 12, 2023

The claim "Docker [...] Works out of the box." is no longer true.
That is because docker now uses BuildKit per default, while the BuildKit Dockerfile syntax is not supported when building docker images with testcontainers-node (e.g. with GenericContainer.fromDockerfile(buildContext).build())

When building a Dockerfile containing BuildKit-features e.g.

RUN--mount=type=cache,id=maven,target=/root/.m2/repository mvn --batch-mode --no-transfer-progress dependency:resolve dependency:resolve-plugins

through testcontains-node (with export 'DEBUG=testcontainers*'), the output currently looks like:

2023-05-12T08:52:02.265Z testcontainers:build [localhost/43420fa7dc4a:2c9e53cede2c] {"errorDetail":{"message":"the --mount option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled"},"error":"the --mount option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled"}

Exporting export DOCKER_BUILDKIT=1 does not change the problem/output.

PS: Sibling issue in testcontainers-java: testcontainers/testcontainers-java#2857

@cristianrgreco
Copy link
Collaborator

Hi @helmlover, see the parent issue: docker/for-linux#1136. BuildKit does not yet seem supported over the Docker HTTP API, as such is only currently available via the CLI.

@osa0805
Copy link

osa0805 commented Jan 31, 2024

Hi,
Is there a plan to add this support ?

@praveensvsrk
Copy link

+1, we need support for this....curious if there a workaround available to achieve the RUN cache like functionality without buildkit features?

@silh
Copy link
Contributor

silh commented Mar 30, 2024

It looks like what's necessary is a support for creating a session and running it in dockerode. Go implementation for that in terraform was added here - https://github.com/kreuzwerker/terraform-provider-docker/pull/387/files#diff-4596d40531ae2e21f6074d104e6dc7317537946b56d95df847c9209dfbe30fceR329 The session run code is here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants