Skip to content

Make it possible to use build docker image using BuildKitΒ #2857

@pawelebe

Description

@pawelebe

As per Docker release 18.09 it is possible to mount cache (using BuildKit) explained

Example dockerfile

# syntax = docker/dockerfile:1.0-experimental

#RUN --mount=type=cache,target=/home/gradle/.gradle gradle build

However when build such image, it is gives an error

Dockerfile parse error line 12: Unknown flag: mount

Code to build:

new GenericContainer<>(
                new ImageFromDockerfile()
                                .withDockerfile(Path.of("Dockerfile").toAbsolutePath())
        )

I order to build such docker image from CLI, you need to set DOCKER_BUILDKIT=1 in order to use buildkit.

While analyzing docker cli source code it seems like it is appending such query parameter to REST API call version=2

Unfortunately, I do not see any documented version parameters in the official API documentation.
https://docs.docker.com/engine/api/v1.40/#operation/ImageBuild

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions