w hat is DockerHub?? Dockerhub is cloud storage, which is used to store Docker images from anywhere and use the image anywhere ...
what is DockerHub??
Dockerhub is cloud storage, which is used to store Docker images from anywhere and use the image anywhere using Docker.
Pushing the Image to Dockerhub:
To Push the local docker image to the docker hub we need to do some steps.
Step 1: Log in to the docker. hub from the command line
Command: docker login --username=yourhubusername
Example:
Step 2: Check the available docker images:
Command: docker images
Step 3: Create the repo inside the docker hub
Step 4: Now the docker image won’t have a tag so need to set the tag for the image.
Here I am going to move the react-nginx image to my docker hub.
Command: docker tag local-image:tag-name new-repo:tagname
Example: docker tag 4853aafa83ff username/react-nginx:firstdocker
After executing the above command check the docker images list.
The docker image with tag name first docker got updated in the docker image
Step 5: Now need to push the docker image to the docker hub.
Command: docker push dockerhubusername/repositoryname
Example: docker push username/react-nginx:firstdockerStep 6: Now need to check the docker hub repository from the browser.
Now I am going to pull the docker image from the docker hub
Example: Here, I am going to pull the httpd Docker image. Now, we have successfully pushed the local docker image to the docker hub changed it to private, and pulled the image from the docker hub.