Hey Techies…👋
In this session , we’re going to learn how to push custom images to docker private repositories.
Before going to the hands-on lab , let’s have some basic ideas on Docker.
📌A Docker image is a file used to execute code in a Docker container which acts as a set of instructions to build a Docker container, like a template.
📌A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.
📌Docker Engine is an open source containerization technology for building and containerizing your applications.
📌A Docker registry is a system for versioning, storing and distributing Docker images.
📌Docker Control Plane is the enterprise-grade cluster management solution from Docker.
📌A private Docker registry allows you to share your custom base images within your organization, keeping a consistent, private, and centralized source of truth for the building blocks of your architecture.
▶️▶️▶️ Let’s get started….!!!
📌Here we’re using Canister.io to create a private repository. I’ve created an instance using Google Cloud account to use CLI. You can opt on your convenience. I’ve created a repo in Canister.io named demoapp and athlearn is my account name.
I have cleaned up all the existing images,containers etc.
🖊️To stop any running container → docker stop $(docker ps -q)
🖊️To remove all the containers → docker rm $(docker ps -a -q)
🖊️To remove all the images → docker rmi $(docker images -a -q)
Now we’re going to build a new image called centos
🖊️docker pull centos
And run the image in detached mode
🖊️docker run -dit centos
Now list the running containers as shown below:
Then login inside to the container as shown below:
And install below packages:
🖊️yum install httpd net-tools vsftpd
Also place a text document as shown below and enable below services:
🖊️systemctl enable httpd
🖊️systemctl enable vsftpd
Then come out from container as shown below : We can conclude commit is successful as we can see the output sha256:..
We can see a new image has been added to images list:
Now tag the newly builded image as shown below by taking the image ID and copy the lines after docker pull from Cansister.io Docker CLI and give a tag v1.0 and again run docker images , so we can see the repository name which we just provided:
Now push the image to private repository as shown below:
We check the image is pushed correctly to repository in 2 ways.
1- By refreshing the https://cloud.canister.io/ page and check the image
2- Pull the image from Cansister.io and check it is successfully pulled using CLI
For that delete the images and remove all containers:
Then run the below command and check the pull is working or not:
🖊️docker pull cloud.canister.io:5000/athlearn/demoapp:v1.0
Hence we can conclude the image push to private repository is successfully completed.
⭐⭐⭐ Enjoy your learning….!!! ⭐⭐⭐