قالب وردپرس درنا توس
Home / Tips and Tricks / How does the Docker Container Register work? – CloudSavvy IT

How does the Docker Container Register work? – CloudSavvy IT



Docker container registers such as Docker Hub are platforms for hosting and sharing Docker containers. While the standard Docker Hub is focused on public containers, most cloud providers such as AWS and GCP will run their own private container registers.

What are Docker Registers?

Container Register is an online storage and distribution system for named Docker images. It̵

7;s similar to a package manager like NPM, because it can also store different versions of images. Anyone who has a registry account can log in and upload built-in images by driving docker push with a username/imagename parameter:

docker push anthonyheddings/testcontainer

If you then want to use that container elsewhere, you can download it in the same way:

docker pull anthonyheddings/testcontainer

If you do not build your image FROM scratch, you’re probably pulling from the Docker Hub. Docker Hub is the default Docker registry.

When writing a Docker file for your application, you can extend images from the Docker Hub using FROM command:

FROM ubuntu

For some containers such as ubuntu, they are Docker Official Images, which means they are used so often that you do not have to enter the username that uploaded it (which may be superfluous if you just type ubuntu/ubuntu).

Labeling of containers

Containers in Docker registers are organized in storage. They are quite similar to the concept of Git archives, except that instead of branches, containers are organized with different tags.

Tags are simply labels that provide a better way to manage version control and versions. You can assign them to all completed buildings. Instead of referring to building ID, you can tag an image with a label in the major.minor.patch format and easily tell which image is which or which shape your organization prefers.

If you do not specify a tag, Docker automatically applies the “latest” tag. When you drag an image from the hub, you probably drag latest unless you enter a version number.

You can use docker tag to manually tag images, but it is much easier to use -t with docker build.

 docker build -t username/image:tag .

When you print the image to the Docker Hub or any other registry, you can drag down different versions depending on their tag.

Alternative to Docker Hub

Docker Hub is the default, so unless you specify another, all Docker commands that work with registers will be added to hub.docker.com by default.

However, many cloud providers will offer their own Docker records as a service, which is usually integrated with the other container-related services they provide. For example, there is the Google Container Registry, which works well with Cloud Run and their Kubernetes service.

You can switch to a new register, you simply prepare the register address for all container references. For GCR it would be gcr.io:

gcr.io/anthonyheddings/test

Just like the Docker Hub, you must log in to the Docker Login registry.

AWS has Elastic Container Registry, which works well with Elastic Container Service and Elastic Kubernetes Service.

Azure has the Azure Container Registry, which works with their Kubernetes service.


Source link