I keep getting BuildKit errors on the latest version of Docker Desktop for Mac Silicon (M2):
the --mount option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled
The Docker documentation claims that BuildKit is automatically installed on the latest Docker Desktop so this does not make sense. I have, as best I can tell, completely uninstalled and re-installed docker and docker desktop but the problem remains.
If I use the DOCKER_BUILDKIT=1 everything runs, but I shouldn’t need to run this, should I? Everything I can find on this topic is people trying to do the opposite (prevent buildkit being used by default). Adding daemon configuration to use "buildkit": true doesn’t seem to have any effect either, but again this should not be required.
Any suggestions would be gratefully received. If seems like something is bugged in my configuration, but I haven’t knowingly changed anything and this just started happening a few weeks ago.
Can you share the exact version number just to see that we are talking about the same version? It also helps future readers understanding what version this issue about.
You are right that poeple were usually doing the opposite to disable buildkit, so one guess is that it was done on your machine as well somehow. Maybe added to bashrc or to whatever shell you are using. I haven’t seen it with the buildkit variable yet, but people did it with other Docker-related variables like DOCKER_HOST.
This wordked for me on my Mac with Docker Desktop 4.60
FROM ubuntu:24.04
RUN --mount=type=bind,source=.,target=/app ls -lahs /app
I’ve checked all the zsh config files and there is nothing docker-related there. I don’t have a bashrc file since I’m using zsh, but that was a good suggestion, it does feel like maybe something is overriding the default.
Sorry, I should have provided version info earier.
Current Docker versions use buildx as default builder. Buildx is based on buildkit, so I don’t know what else could override the builder than an env variable somewhere, but you can try two more things I can think of.
I don’t actually know if you could disable buildkit for individual builders, but you can inspect the current builder by running: docker builder inspect. IT should show the buildkit version like on my machine: BuildKit version: v0.27.0
Ah, ok @rimelek thanks for your help with this. It looks like your first suggestion was on the money. If I run env I can see that somewhere I have two variables set:
DOCKER_BUILDKIT=0
COMPOSE_DOCKER_CLI_BUILD=0
Now I just need to figure out …where. Thanks again!