当使用docker:24.0.0-dindwith docker:24.0.0-cli, todocker build而不先安装 Git 时,我们会收到警告:
警告:buildx:系统中未找到 git。构建未捕获当前提交信息
如果在运行之前安装了 Git,会捕获哪些信息docker build?
# Git is not installed at this point
# "WARNING: buildx: git was not found in the system. Current commit information was not captured by the build"
docker build -t "$REGISTRY/without-git" .
apk add git
# Git installed. No more buildx warning.
docker build -t "$REGISTRY/with-git" .
docker push "$REGISTRY/without-git"
docker push "$REGISTRY/with-git"
# stdout: null
docker buildx imagetools inspect "$REGISTRY/without-git" --format …Run Code Online (Sandbox Code Playgroud)