Reputation: 25964
I am trying to buildx push to local registry. I have docker login <registry>
success.
I am building on macos. And it looks like it has something to do with docker-container
.
standart docker works:
docker build -t <registry>/demo
docker push <registry>/demo
But buildx do not work:
docker buildx create --use --name my-builder --driver-opt network=host --buildkitd-flags '--allow-insecure-entitlement network.host' --use
or this:
docker buildx create --name my-builder --platform $platforms --driver docker-container --driver-opt network=host --use
I get this error:
docker buildx build --builder my-builder --tag <registry>:5000/demo -f Dockerfile .
...
=> ERROR exporting to image 0.3s
=> => exporting layers 0.2s
=> => exporting manifest sha256:b7bbe730a33ba61b903b4371ded8057dd1a129fd60ff261e3a3ce5ef3425924e 0.0s
=> => exporting config sha256:c38954cc53caf2cc4dd08ea836c3f2ab8951f400ce6731401628c9ba78f4ce5f 0.0s
=> => pushing layers 0.0s
------
> exporting to image:
------
ERROR: failed to solve: failed to do request: Head "https://<registry>:5000/v2/demo/blobs/sha256:659301074bba138f5e7a1896fbe03daa5d95ce5b4f804af5a2c9ea03e9411b8b": http: server gave HTTP response to HTTPS client
is there anything special you have to do to use buildx to push?
Upvotes: 2
Views: 2596
Reputation: 583
If you are using local registry, such as:
$ docker run -d -p 5001:5000 --restart always --name registry registry:2
(In my setup , the local registry port is 5001 not 5000 since a mac osx (m1 apply silicon) has a process on that port).
then you probably need to create the custom buildx (bash script), such as:
#!/bin/sh
name=container-builder
docker buildx ls | grep -q $name && docker buildx rm $name
docker buildx create --driver-opt network=host --use --config config.toml --name $name
and the config.toml file has:
[registry."localhost:5001"]
http = true
Also, for my local registry in the Docker Engine (via Dashboard), added to the docker daemon configuation:
"experimental": true,
"features": {
"buildkit": true
},
"insecure-registries": [
"localhost:5001"
]
That should fix the http vs https errors for a local registry.
Upvotes: 3