By pushing an image to the Docker hub registry, we can create an instance of an image in which a particular type of software and applications are pre-installed and can be pulled again whenever you want to work on that particular type of image or applications and run that kind of virtual machine. In the docker hub, there are millions of images you can also pull the default images which are created by the particular organizations for example you can pull the Ubuntu image which is uploaded by Linux and then install any software or application into that image like curl command, Jenkins, etc and then push that image to your docker hub registry.
- A docker hub account.
- Installed docker software in your respective operating system.
- A pulled image in your docker container which you want to pull in docker hub repository.
Follow the below steps to achieve so:
Step 1: The first step is to give a tag to your docker image which is a reference to your docker image ID which conveys the information regarding the image version. If you login to your docker hub account and search for a standard image of MySQL, HTTP, etc there you notice these tags.
docker image tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
If you do not mention the tag then the default tag is the latest. For example,
docker image tag ubuntu:14.04 XYZ/ubuntu:2.0
Ubuntu is a source image in our docker container 14.04 is the tag to that source image.XYZ in the target image name has to be similar to your docker hub account username and the tag is 2.0.
Step 2: Now if you try to push the image then it will give an error:
denied: requested access to the resource is denied
The reason is that for pushing the image in your docker hub account first you have to log in. So the second step is to log in to your docker hub account. To login, the command is
Now write your respective username and password you give while creating a docker hub account.
Note: If you are a Mac user after pushing your image do not forget to logout because the authentication key is written to a file to remember you as user of that docker hub account in the future if it is your personal device no need to do this.
Step 3: Now after you login you are able to push the image the command is:
docker image push [OPTIONS] NAME[:TAG]
docker image push XYZ/ubuntu:2.0
After running this command your image will be pulled to the docker hub repository.
Note: Write sudo before every command if your image is in the root account and XYZ is your username of docker hub account.
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.
- Docker - Search Image in Dockerhub through CLI
- Creating a Private Repository and Push an Image to That Private Repository
- 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
- 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
- MATLAB | Complement colors in a Grayscale Image
- Background Subtraction in an Image using Concept of Running Average
- MATLAB | Display histogram of a grayscale Image
- LSB based Image steganography using MATLAB
- Text extraction from image using LSB based steganography
- Image Complement in Matlab
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.