buildx: Buildx doesn't respect insecure registries
Contributing guidelines
- I’ve read the contributing guidelines and wholeheartedly agree
I’ve found a bug and checked that …
- … the documentation does not mention anything about my problem
- … there are no open or closed issues that are related to my problem
Description
Using the buildx plugin the insecure registries are not working after the latest update. By default it tries HTTPS (443). Issue visible on multiple systems.
Expected behaviour
Use port 80
Actual behaviour
Uses port 443
Buildx version
github.com/docker/buildx v0.12.1 30feaa1
Docker info
Client: Docker Engine - Community
Version: 25.0.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.12.1
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.24.2
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 25.0.1
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: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: a1496014c916f9e62104b33d1bb5bd03b0858e59
runc version: v1.1.11-0-g4bccb38
init version: de40ad0
Security Options:
seccomp
Profile: builtin
Kernel Version: 5.15.133.1-microsoft-standard-WSL2
Operating System: Ubuntu 22.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 11.58GiB
Name: Re4zOon-ThinkBook
ID: WYZY:FVFE:G4KA:VOCH:RMQ7:LJSQ:FEDQ:BUQ2:BR63:KVHY:WAFU:C2XH
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
our-registry
127.0.0.0/8
Live Restore Enabled: false
WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
Builders list
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
default * docker
default default running v0.12.4+3b6880d2a00f linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/amd64/v4, linux/386
desktop-linux error
Cannot load builder desktop-linux: protocol not available
Configuration
FROM our-registry/base-images/debian:latest
RUN echo "hello"
Build logs
❯ docker build .
[+] Building 0.1s (2/2) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 112B 0.0s
=> ERROR [internal] load metadata for our-registry/base-images/debian:latest 0.0s
------
> [internal] load metadata for our-registry/base-images/debian:latest:
------
Dockerfile:1
--------------------
1 | >>> FROM our-registry/base-images/debian:latest
2 |
3 | RUN echo "hello"
--------------------
ERROR: failed to solve: our-registry/base-images/debian:latest: failed to do request: Head "https://our-registry/v2/base-images/debian/manifests/latest": dial tcp 192.168.1.1:443: connect: no route to host
Additional info
Insecure registry is set properly in /etc/docker/daemon.json:
❯ cat /etc/docker/daemon.json
{
"insecure-registries":["http://our-registry", "our-registry"],
"hosts": ["unix:///mnt/wsl/shared-docker/docker.sock"]
}
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 27 (3 by maintainers)
Hi,
This is still not solved, can you please reopen it? @crazy-max
I have been pulling my hair for a day now trying to understand how this actually works, because it is fairly schizofrenic.
So adding an http mirror into daemon.json, will cause most of the “normal” docker commands to actually use that mirror as is (namely, use http).
However, this also makes buildkit use that mirror, but instead call it via https (WTF?). Not only that, it will then wait for a timeout on EVERY request (30-60 seconds, even more WTF) before moving onto calling the docker hub registry directly, making it seemingly “work” but completely defunct because pulling the image takes forever. Just getting metadata takes 90 seconds for me.
The only way I managed to get it to work, is to declare a NEW builder with a NEW config that configures the mirror as a repository with
http = true, but this instead gives me another builder that isn’t used by default when invokingdocker build, only when callingdocker buildx(woot), and most of CI builds (where I use this) is actually building behind the scenes via docker compose, I have no clue how that would work. I also seem to need to add--outputflag to the build command to actually store the image, this is a lot of hoops to get this working.This also seem to have been an ongoing issue for the past 6 years or so (when trying to follow the various issues filed for this), where to me, since it obviously uses the mirror configuration from daemon.json (and knows about it), why wouldn’t it also respect the http scheme like the rest of the docker tooling?
What is this https enforcement actually trying to enforce?
Same problem on a fresh install of Docker 26.1.2 in an VM with Oracle Linux 8.9. Executing the command “docker build .” results in failure if the base image is in an insecure registry. Looks like the “insecure-registries” property in the file “/etc/docker/daemon.json” is still being ignored.
I can manually pull the same image without problem.
The workaround for now is using “export DOCKER_BUILDKIT=0”.
docker builder version github.com/docker/buildx v0.14.0 171fcbe
Example of a docker compose setup:
v0.13.1 fail use http registry. My flow shown as below
buildx-config.toml
Buildx keep requesting https, in the end locking to old version with
--driver-opt image=moby/buildkit:v0.12.2.Hi,
Any updates? Its blocking our second upgrade schedule for our jenkins’.
#Step1 # craete buildx config file on your local machine mkdir -p ~/.docker/buildx cat > ~/.docker/buildx/buildkitd.toml << EOF debug = true [registry.“114.67.223.128:5080”] http = true insecure = true
[registry.“http://114.67.223.128:5080”] http = true insecure = true EOF
#Step2 create builder with the config file specified docker buildx create --name mybuilder
–driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=10485760
–driver-opt env.BUILDKIT_STEP_LOG_MAX_SPEED=10485760
–driver-opt env.BUILDKIT_UNSAFE_HTTP=1
–config ~/.docker/buildx/buildkitd.toml
–use
You can try to fix the http request problem by specify --config param .It works for me .
@martadinata666, I have exactly same issues with exactly same commands in my ubuntu server, which blocks our CI/CD pipeline in Jenkins. 😦 However, it works in my mac with M2 chip.
Ubuntu Docker version:
Mac Docker version: