'docker build command tries to connect https to insecure registry
I have an issue to build my image, because docker build is connecting via https.
failed to solve with frontend dockerfile.v0: failed to create LLB definition:
failed to do request: Head "https://harbor.local/v2/undertow-revocation-filter/manifests/latest":
dial tcp 10.180.136.12:443:
connect: connection refused
docker is configured with insecure registry
"insecure-registries": [
"harbor.local"
]
Docker file begins
FROM harbor.local/undertow-revocation-filter as undertow
docker pull from harbor.local works, curl with http works (curl http://harbor.local/v2/undertow-revocation-filter/manifests/latest)
This is for me unclear, why docker build is downloading metadata with https. I am using docker for windows 3.6.0.
Solution 1:[1]
I had to set DOCKER_BUILDKIT=0
before the build command:
set DOCKER_BUILDKIT=0
docker build . -t fooimage
Solution 2:[2]
From the documentation the insecure-registries option,
With insecure registries enabled, Docker goes through the following steps:
First, try using HTTPS.
- If HTTPS is available but the certificate is invalid, ignore the error about the certificate.
- If HTTPS is not available, fall back to HTTP.
So it's expected that docker first tries using HTTPS before falling back to HTTP.
Maybe you should specify the port on which your local registry listens :
"insecure-registries": ["harbor.local:80"]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Oli |
Solution 2 | Samuel Rossille |