Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when pushing the image to an insecure docker registry #1586

Closed
victorpaulo opened this issue Jul 21, 2020 · 1 comment · Fixed by #1601
Closed

Error when pushing the image to an insecure docker registry #1586

victorpaulo opened this issue Jul 21, 2020 · 1 comment · Fixed by #1601
Labels
Milestone

Comments

@victorpaulo
Copy link

victorpaulo commented Jul 21, 2020

Hi,

I am trying to build and push an image from Kubernetes, however I am getting the following error:

It seems the buildkit is ignoring the directive "registry.insecure=true" provided;

....
#10 exporting to image
#10 sha256:e8c613e07b0b7ff33893b694f7759a10d42e180f2b4dc349fb57dc6b71dcab00
#10 exporting layers
#10 exporting layers 4.1s done
#10 exporting manifest sha256:b5b33135963e5fcf697258a8310df21e05be4de4e545fb4e2f7aff122c2254eb done
#10 exporting config sha256:4e6f1ba171398a02d870890e1329669668d720a20a949f1d32d12cbe83cb24de done
#10 pushing layers 0.0s done
#10 ERROR: failed to do request: Head https://kind-registry:5000/v2/nodejs-test/blobs/sha256:aa0808f0538f11b534700e391065ba093d3d67d35203687b70b24d175941cbcb: http: server gave HTTP response to HTTPS client
------
 > exporting to image:
------
error: failed to solve: rpc error: code = Unknown desc = failed to do request: Head https://kind-registry:5000/v2/nodejs-test/blobs/sha256:aa0808f0538f11b534700e391065ba093d3d67d35203687b70b24d175941cbcb: http: server gave HTTP response to HTTPS client

This section is the command build inside a K8s Job.

...
  containers:
      - args:
        - build
        - --frontend
        - dockerfile.v0
        - --local
        - context=/workspace/build
        - --local
        - dockerfile=/workspace/build
        - --output
        - type=image,name=kind-registry:5000/nodejs-test:5.0,push=true,registry.insecure=true
        command:
        - buildctl-daemonless.sh
        image: moby/buildkit:master
....

My docker config file:

  • Also added insecure registry in the docker daemon.
{
        "auths": {
                "https://index.docker.io/v1/": {},
                "kind-registry:5000": {},
                "localhost:5000": {}
        },
        "HttpHeaders": {
                "User-Agent": "Docker-Client/19.03.8 (darwin)"
        }
}

The file above was imported as a secret on Kubernetes v1.18.2:

kubectl create secret generic regcred \
 --from-file=.dockerconfigjson=/Users/me/.docker/config.json \
 --type=kubernetes.io/dockerconfigjson

I've tested Kaniko as well and I was able to solve the same problem with "--insecure" directive in the executor command.

Please how can I solve this issue?

Thanks in advance,
Victor

@tonistiigi
Copy link
Member

This is a regression from #1397

Use buildkitd config as a workaround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants