The Google Container Registry is a private storage service for Docker images, used to run container apps. It is used to host images for distribution on other GCP container services, such as Cloud Run and Kubernetes Engine.
What is the Google Container Registry?
When working with Docker images, you often press and drag them from a container register used for storage and quick central access. The most popular register is the official Docker Hub, which is public, but many cloud providers offer private container registers. Google̵7;s container registry is one of these and provides your own registry for your GCP account.
It’s pretty easy to use. With a certain configuration of Docker, you should be able to print and drag pictures with
docker tag and
docker push, then these updates have been distributed as container updates to the Kubernetes Engine.
The container register is not available for accounts that have not activated invoicing. However, it is very cheap – containers are stored in a Cloud Storage bucket and you only pay 0.026 USD per GB per month for storage, as well as standard data costs for output. Alternatively, you can enable “Vulnerability Scan”, which costs $ 0.26 per container update to check for vulnerabilities in the underlying software used in the container.
Move images to GCR
Before we begin, you need to make sure you have the Google Cloud SDK installed, which gives you access to
gcloud CLI. Of course, you also need Docker installed to work with container images in the first place.
You must enable the Container Registry API. Click “Activate”.
Because the repository is private, you must configure Docker to work with gcloud authentication, which can be done automatically with the following command that makes some changes to your Docker configuration to add gcloud CLI as a reference helper:
gcloud auth configure-docker
You need your project ID for the next step; this can be seen in the “Select project” drop-down menu in the GCP console. Copy ID.
Then you can tag the image as usual
docker tag, provides only a custom hostname for GCR. By default,
gcr.io stores images in a cloud storage bin in the United States. You can also use
asia.gcr.io for these regions.
docker tag [SOURCE_IMAGE] gcr.io/[PROJECT-ID]/[IMAGE]
This marks the image as
latest, default for new distributions, but if you want to use a different tag, you can add
:tag to the image name.
Once tagged, you can upload it to GCR with
docker push gcr.io/[PROJECT-ID]/[IMAGE]
Once uploaded, they are visible in the Container Registry console or by running
gcloud container images list-tags, and you can use them for your Cloud Run and Kubernetes distributions.
If you want to drag down the image manually, you can do so with
docker pull gcr.io/[PROJECT-ID]/[IMAGE]:[TAG]
Of course you need
gcloud installed and configured as an authentication aid on the machine that does the drawing, otherwise you can not authenticate.