In this article, we show how to create a docker hub account and pull the image from the docker hub repository and pushing our image to the docker hub repository. As docker hub is a public repository that can be accessed by anyone so one can create their own private repository to which they can push and pull their image. For this, there is a registry container from the docker itself.
- Installed docker software in your respective operating system.
- A pulled image in your docker container which you want to push into your private repository.
Steps to create a private repository and push and pull the image:
Step 1:The first step is to use the docker run command to download the private registry.
sudo docker -d -p 5000:5000 --name registry registry:2
Description of commands:
- -d: This option is used to run the container in detached mode i.e the container can run in the background.
- -p: This option is used to map our port number with 5000 port numbers on our localhost.
- registry: It is a container provided by docker to host our private repositories.
- 2: It is a tag to a registry to differentiate on the docker host.
You can use the docker ps command to see the running registry container.
sudo docker ps
Step 2: In this step, we are going to tag our existing image so that we can push that image to our local repository.
sudo docker tag image_id tag_name
Description of commands:
- image_id: The id of the image you want to push to your private repository.
- tag_name: The name you want to give to your tag.
Step 3: We have tagged our image now it is ready to push to the private repository.
sudo docker push tag_name
Step 4: Now delete the local images so that we can pull it from a private repository. To delete the image use rmi command.
sudo rmi image_id
Step 5: In the previous step, we have deleted all the images now we pull the image from the private repository by docker pull command.
sudo docker pull image_tag
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- How to tag an image and push that image to Dockerhub ?
- Creating a Docker Image with Git Installed
- Overview to the Amazon Virtual Private Cloud
- MATLAB | RGB image to grayscale image conversion
- MATLAB | Converting a Grayscale Image to Binary Image using Thresholding
- Image Edge Detection Operators in Digital Image Processing
- Creating interactive maps and Geo Visualizations in Java
- Creating a Network in Docker and Connecting a Container to That Network
- Creating a simple machine learning model
- Creating a gateway | AWS Storage Gateway
- Creating an Alpine Docker Container
- Display the red, green and blue color planes of a color image in MATLAB
- Extract bit planes from an Image in Matlab
- Digital Image Processing Basics
- Image Compression using Huffman Coding
- Image Processing in MATLAB | Fundamental Operations
- MATLAB | RGB image representation
- MATLAB | Complement colors in a Binary image
- MATLAB | Complement colors in RGB Image
- What is Image Blurring
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.