Docker send credentials to docker.io when registry URL doesn't contain a host but has a scheme and a path #47795
Labels
kind/bug
Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed.
status/0-triage
Description
Found in Gitlab CI that if registry URL doesn't contain host but has scheme and path docker will try to login to registry-1.docker.io. This is happening when hostname is in env variable and this variable is empty.
I have this problem with Docker on Ubuntu 20.04 but I think OS isn't relevant to this issue.
Tested versions:
Also tested with podman as daemon and run
docker:latest
image with hashsha256:8bd6302a909f6f2ed9a17058cce2d83442bddb9e65c974352c2ba485a1e6d7ba
and with podman there is no problem.Reproduce
Docker daemon + docker image:
sudo docker run -it --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock docker:latest ash
export REGISTRY_LOGIN="test" REGISTRY_PASS="test"
docker login "https:///repository/docker/" -u "$REGISTRY_LOGIN" -p "$REGISTRY_PASS"
Podman daemon + docker image:
systemctl start --user podman.socket
Run podman socket as user (rootless)podman run -it --rm --privileged -v $XDG_RUNTIME_DIR/podman/podman.sock:/var/run/docker.sock:Z docker:latest ash
export REGISTRY_LOGIN="test" REGISTRY_PASS="test"
docker login "https:///repository/docker/" -u "$REGISTRY_LOGIN" -p "$REGISTRY_PASS"
Expected behavior
Docker has to check URL for empty hostname and show error about invalid address instead of fallback to
registry-1.docker.io
docker version
Client: Docker Engine - Community Version: 26.1.1 API version: 1.45 Go version: go1.21.9 Git commit: 4cf5afa Built: Tue Apr 30 11:48:20 2024 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 26.1.1 API version: 1.45 (minimum version 1.24) Go version: go1.21.9 Git commit: ac2de55 Built: Tue Apr 30 11:48:20 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.31 GitCommit: e377cd56a71523140ca6ae87e30244719194a521 runc: Version: 1.1.12 GitCommit: v1.1.12-0-g51d5e94 docker-init: Version: 0.19.0 GitCommit: de40ad0
docker info
Additional Info
No response
The text was updated successfully, but these errors were encountered: