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

Error while building an image: the --mount option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled #237

Closed
Yoric opened this issue May 30, 2022 · 5 comments · Fixed by #276
Labels
help wanted Extra attention is needed

Comments

@Yoric
Copy link
Contributor

Yoric commented May 30, 2022

I receive this error while attempting to build https://github.com/matrix-org/synapse/ (the Dockerfile is in docker/Dockerfile).

I haven't found a way to work around this with Bollard yet. I don't know if it's something that needs to be added to/made easier to find in the documentation or something that requires a code change.

According to my logs

{
  "Platform": {
    "Name": ""
  },
  "Components": [
    {
      "Name": "Engine",
      "Version": "20.10.12",
      "Details": {
        "ApiVersion": "1.41",
        "Arch": "amd64",
        "BuildTime": "2022-02-10T15:03:35.000000000+00:00",
        "Experimental": "false",
        "GitCommit": "20.10.12-0ubuntu2~20.04.1",
        "GoVersion": "go1.16.2",
        "KernelVersion": "5.4.0-113-generic",
        "MinAPIVersion": "1.12",
        "Os": "linux"
      }
    },
    {
      "Name": "containerd",
      "Version": "1.5.9-0ubuntu1~20.04.4",
      "Details": {
        "GitCommit": ""
      }
    },
    {
      "Name": "runc",
      "Version": "1.1.0-0ubuntu1~20.04.1",
      "Details": {
        "GitCommit": ""
      }
    },
    {
      "Name": "docker-init",
      "Version": "0.19.0",
      "Details": {
        "GitCommit": ""
      }
    }
  ],
  "Version": "20.10.12",
  "ApiVersion": "1.41",
  "MinAPIVersion": "1.12",
  "GitCommit": "20.10.12-0ubuntu2~20.04.1",
  "GoVersion": "go1.16.2",
  "Os": "linux",
  "Arch": "amd64",
  "KernelVersion": "5.4.0-113-generic",
  "BuildTime": "2022-02-10T15:03:35.000000000+00:00"
}
@fussybeaver
Copy link
Owner

Thanks, that's interesting.. I had a quick look but didn't find a whole lot of documentation or prior art on how this could be done. Going to keep looking..

@Yoric
Copy link
Contributor Author

Yoric commented May 31, 2022

I'm currently trying to understand how DOCKER_BUILDKIT is interpreted by docker-cli. So far, all I found out is that it involves some internal plug-in: https://github.com/docker/cli/blob/1c5256d8e170225b0a84a5e1a56ff2c7d2374e3c/cmd/docker/builder.go#L90.

I suspect that the plug-in is https://github.com/docker/buildx .

@fussybeaver fussybeaver added the help wanted Extra attention is needed label Jun 6, 2022
@cmac4603
Copy link
Contributor

cmac4603 commented Oct 16, 2022

This is no way near working, but I've been toying with having bollard call the docker API to use buildkit and opened what I have so far in this PR #264.

Buildkit is the new default backend the docker CLI uses for building docker images, and comes with a host of improvements like secrets & SSH key artifacts no longer in image layers.

The PR needs a lot more work, but it might help

@fussybeaver
Copy link
Owner

A PR landed in master that addresses the buildkit implementation. Please test it to see if it works for you, and/or let me know if you need help getting it working. There is an example that builds a tarball prior to invoking the API - I think you'll need to do the same with Synapse, because there are some additional files needed by Synapse when building the container.

@cmac4603
Copy link
Contributor

Just ran the example, works really nicely 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants