简体   繁体   中英

How do I docker buildx build into a local "registry" container

I am trying to build a multi-arch image but would like to avoid pushing it to docker hub. I've had a lot of trouble finding out how to control the export options. is there a way to make "--push" push to a registry of my choosing?

Any help is appreciated

Docker provides a container image for a registry server that you may self run even on localhost, see: Deploying a registry server .

There are other servers|services that implement the registry API (see below) but this is a good place to start.

Conventionally, images pushed|pulled default to Docker registry; unless a registry is explicitly specifed, an image eg your-image:your-tag defaults to docker.io/my-image:my-tag . In my opinion, it's a good practice to always include this default to be more transparent about this.

If you run Docker's registry image on localhost on the default port 5000, you'll need to take your images with localhost:5000/your-image:your-tag to ensure that when you docker push localhost:5000/your-image:your-tag , the CLI is able to determine your local registry is the intended destination.

Similarly, if you use eg Quay registry, images must be prefixed quay.io , Google Artifact Registry , images are prefixed ${REGION}-docker.pkg.dev/${PROJECT}/${REPOSITORY} etc.

IIRC it's not possible to push to Docker's registry (aka dockerhub) without an account so, as long as you ensure you're not logged in, you should not accidentally push images to Docker's registry.

NOTE You only need to use a registry to ease distribution of container images between machines. If you're only interested in local(host) development, you can docker run... immediately after a successful docker build without any pushing|pulling (beyond interim images, eg FROM ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM