xetra11
xetra11

Reputation: 8875

docker difference between private registry and the local image registry?

I have something on my mind that is bugging me. When running docker images I see a list of my local images I have in my docker environment. When pulling Images I pull it from a registry and more specific pull the specified tag managed by the repository.

But what is docker images then? It's a registry as well isn't it? It holds all images that I've built locally or pulled.

If my claim is valid:

How does it comply with running a private registry (mentioned here https://docs.docker.com/registry/deploying/)

Running this docker run -d -p 5000:5000 --restart=always --name registry registry:2 Would deploy this new registry into my docker images...

So now I have a registry within my registry... registception? What is the difference besides the custom registry is deployable?

Upvotes: 9

Views: 5450

Answers (3)

yamenk
yamenk

Reputation: 51866

Its not a local image registry as other questions have pointed. It is an image cache. The purpose of the image cache is to avoid having every time to download the same image whenever you do a docker run.

docker images simply lists all the cached images on the machine. Whenever there is newer image on the registry, the image(some layers) are downloaded and cached when doing docker pull .... Also, when a layer exists in the local cache, docker tells you that, example:

Step 2/2 : CMD /bin/bash
 ---> Using cache

On the other hand, a docker registry is a central repository to store images. It provide a remote api to pull and push images. The local image cache does not have this feature. Images in the local cache are read and stored used local docker commands that simply read files under /var/lib/docker/...

Upvotes: 8

jhernandez
jhernandez

Reputation: 937

Your local image registry as you mentioned are all those images that you have build locally or pulled from a registry public or private you can see it like a local cache of images that you can re use without download or rebuild each time.

Running the registry what actually does is to spin up a server that implements the Docker Registry API which allows users to push, pull, delete and handles the storage of this images and their layers. See it like a central repository like npm, nexus

For example if you run the registry in your.registry.com:5000

You can do things like

docker build -t your.registry.com:5000/my-image:tag .
docker push your.registry.com:5000/my-image:tag

So others that have access to your server can pull it

docker pull your.registry.com:5000/my-image:tag

Upvotes: 1

Janshair Khan
Janshair Khan

Reputation: 2687

To make things clear, think of Docker remote registries (such as Docker Hub) as the remote Git repositories. You pull Docker images (like git repositories) that you need and you play with it.

Like remote Git repositories such as GitHub\BitBucket, Docker registries are also public and private. Public registries are for public usage and open-source projects. Examples include in like Docker Hub. Where as private registries are for organizational use or for your own. Examples for private registries include Azure Container Registry, EC2 Container Registry etc.

The official Docker Registry image is just a Docker registry image for your own system, you can't share them with others unless you have a server or a public Internet IP address. Think of it as Bonobo Private Git Server for Windows.

Upvotes: 2

Related Questions