
When created, container images are saved in a location where they can be accessed for more innovation and updates, as well as shared by multiple users across different hosts, because developers and testers both require access to images during various development and testing phases. This shared storage location can be used in conjunction with a software solution that provides security features and image version control via tags. Image repositories are collections of images that are part of the same project or are grouped according to context. A prefix to the image name identifies the repository. Image registries, on the other hand, hold image repositories.Other similar guides can be found here: How to Fix MS Excel Crash Issue and How to Fix Hyper-V Virtual Machine Stuck in Stopping State and How To Install Nextcloud on a Linux system also How to install Zabbix Monitoring Tool on a Linux System and How to install Golang on a Linux System
More guides can be found here: How to reveal the WiFi password of the Network you are connected to in Windows and How to install Zabbix Monitoring Tool on a Linux System and How to Install Docker Portainer on Linux and How to Install MongoDB on a Linux System also How to install AnyDesk on a Linux Machine and How to install Golang on a Linux System
Step1: Pull docker registry image from docker hub
sudo docker pull distribution/registry
Step2: Run Docker’s registry container image
Let’s create a private registry using Docker’s registry container image with the command:
docker run -d -p 5000:5000 --restart=always --name registry registry:2
We mapped the registry’s port 5000 to the host port5000 while it was running in a “registry” container so that we could access it via localhost. .
Step3: Populate the registry
There are currently no images in the private registry. So, let’s populate it by retrieving an image from the public registry Docker Hub, tagging it, and pushing it into the private registry, while also listing local cache registries to validate
docker image pull alpine:3.14
verify what we have with the command:
docker images
Step4: Tag the image
Tag the newly pulled image:
docker image tag alpine:3.14 localhost:5000/myalps
verify this with docker images
Step5: Push the tagged image
Push the newly tagged image to the private registry:
docker image push localhost:5000/myalps
Step6: Remove cached image
we will remove cached images alpine 3:14 and localhost:5000/myalps
docker image rm alpine:3.14
docker image rm localhost:5000/myalps
verify with docker images
sudo docker images
Step 7: Pull the images
Let”s pull the images from the private registry
sudo docker image pull localhost:5000/myalps
Verify this with docker images
Step 8: remove docker images
Let’s remove images that are no longer needed after successfully validating that the private registry can store container images and that it can be used to push and pull images to and from it.
docker image rm -f registry:2
We can also do same with the tagged image using the command:
docker image rm localhost:5000/myalps
Summary
Images need to be stored after they have been created and a perfect place to store container images will be a private docker registry. The steps to create one are shown above