Contributing guidelines
I've found a bug and checked that ...
Description
There is an annoying warning when running sudo docker build ... in a git repository.
Expected behaviour
$ ls -A1
Dockerfile
$ cat Dockerfile
FROM scratch
$ git init
Initialized empty Git repository in ...
$ sudo docker build --tag test .
...
Actual behaviour
$ sudo docker build --tag test .
...
WARNING: current commit information was not captured by the build: failed to read current commit information with git rev-parse --is-inside-work-tree
Buildx version
github.com/docker/buildx v0.34.0 3e73561
Docker info
Client: Docker Engine - Community
Version: 29.5.0
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.34.0
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v5.1.3
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 55
Server Version: 29.5.0
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
CDI spec directories:
/etc/cdi
/var/run/cdi
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 77c84241c7cbdd9b4eca2591793e3d4f4317c590
runc version: v1.3.5-0-g488fc13e
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.8.0-111-generic
Operating System: Ubuntu 22.04.5 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 3.729GiB
Name: ...
ID: ...
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
::1/128
127.0.0.0/8
Live Restore Enabled: false
Firewall Backend: iptables
EnableUserlandProxy: true
UserlandProxyPath: /usr/bin/docker-proxy
Builders list
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
default* docker
\_ default \_ default running v0.30.0 linux/amd64 (+3), linux/386
Configuration
$ git init
$ sudo docker build --tag test .
Build logs
$ sudo docker build --progress plain --tag test .
#0 building with "default" instance using docker driver
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 50B done
#1 DONE 0.1s
#2 [internal] load .dockerignore
#2 transferring context:
#2 transferring context: 2B done
#2 DONE 0.4s
#3 exporting to image
#3 writing image sha256:471a1b8817eefb6569017c1a76f288e0d4e5c8476eb199485c469d0b033168bf 0.1s done
#3 naming to docker.io/library/test
#3 naming to docker.io/library/test 0.2s done
#3 DONE 0.3s
WARNING: current commit information was not captured by the build: failed to read current commit information with git rev-parse --is-inside-work-tree
Additional info
As far as I understand the reason of issue is absence of SUDO_UID environment variable when running git command.
$ git init
Initialized empty Git repository in ...
$ sudo -s
# env -i git rev-parse --is-inside-work-tree
fatal: detected dubious ownership in repository ...
# env -i SUDO_UID="$SUDO_UID" git rev-parse --is-inside-work-tree
true
At first glance, here is a good place to put this variable but I don't know where to put it exactly.
There is also related issue #1881
Contributing guidelines
I've found a bug and checked that ...
Description
There is an annoying warning when running
sudo docker build ...in a git repository.Expected behaviour
Actual behaviour
Buildx version
github.com/docker/buildx v0.34.0 3e73561
Docker info
Builders list
Configuration
FROM scratchBuild logs
Additional info
As far as I understand the reason of issue is absence of SUDO_UID environment variable when running git command.
At first glance, here is a good place to put this variable but I don't know where to put it exactly.
There is also related issue #1881