Push and Pull container images to docker hub
In this blog, we will show you how to push and pull container images to docker hub using PowerShell docker commands.
SIGNUP USER WITH DOCKER HUB
- First, Go to hub.docker.com website.
- Provide dockerID, email address & password to signup with docker hub website.
- Once you click the sign-up button, It shows the below screen.
- We will get the confirmation email to our inbox. We need to click on that link to activate it.
- Once you click on the activation link, it shows the login page.
- Now provide docker ID and password and click login.
- Once we logged in, it shows the below screen.
RE-TAGGING THE IMAGES
- In this demo, we use logesassistanz as username and it will be the namespace and should be included in the image names.
- Go to PowerShell window and list the images.
- If we look into the base container OS images they are formatted with the name Microsoft.
- Basically, it contains namespace/name of the repository where images available. Our images are currently tagged as web. We need to re-tag these images. So execute the below command to re-tag the images.
docker tag web:latest logesassistanz/web:latest
- Run the docker images command to verify the changes.
- Now, untag the old image from the image list.
- Now everything is set. Images are looking manageable now.
LOGGING INTO DOCKER HUB
- Login into docker hub from Powershell, execute the below command.
docker login
- Provide the username/password to login into docker hub. After successful login, it shows Login succeeded.
PUSHING IMAGES INTO DOCKER HUB
- To push the images into docker hub, execute the below command.
docker push logesassistanz/web:latest
- Now push web v1 version image.
- Now check the docker hub repository and we can able to find our two tags of our images.
- To make this repository as private, Click on settings.
- Click on Make Private button.
- Type the word web and click confirm.
- That’s it. This repository is now private.
PULLING CONTAINER IMAGES
- First, we will remove the existing images from the list using rmi command.
- Run docker images command to verify the image lists.
- To pull the images, use the below command.
Syntax : docker pull <namespace name>/<repository name>:<tag>
Example : docker pull logesassistanz/web:v1
- The process completed successfully. Type docker images command to verify it.
VIDEO
Thanks for reading this blog. We hope it was useful for you to learn how to pull and push images using docker hub repository.
Loges