When I try and add a git repo to my image with ADD I get the error:
ERROR: failed to solve: instruction ADD <git ref> requires the labs channel
Unless I have missed something, the documentation all seems to suggest that ADD <git ref> is stable and supported. Why would I see this error? I also cannot see anything about how to switch to the “labs” channel.
I am running RHEL8 and my docker version is:
$ docker --version
Docker version 24.0.7, build afdd53b
# syntax=docker/dockerfile:1
FROM alpine
ADD --keep-git-dir=true https://github.com/moby/buildkit.git#v0.10.1 /buildkit
The first line is not just a comment, but the buildkit syntax version. It is indeed not the labs channel, but it could be that the error message is misleading and it just doesn’t have the syntax version or not correctly.
Or your docker client version is good, but the daemon is not. Or you are trying a specific syntax which is not supported yet even though git ref would be supported but not that way.
These are just guesses without seing what you did, but ŰI hope the documentation about the labs channel will help.
I don’t know, I assume this buildkit feature was for simple cases. I would use multi-stage build and in the first stage I would install git or use an image that already has it, clone the project, then in the second stage I would copy the project from the first stage.Then you have all the features git has and you can prepare the project any way before copying it to the final stage without producing multiple image layers.