DEV Community

Cover image for Push and Pull a Docker Image from Docker Hub
Khairun Nahar Nowrin
Khairun Nahar Nowrin

Posted on

Push and Pull a Docker Image from Docker Hub

Install Docker

  • First you need to have Docker installed on your machine

  • To install Docker, you will need to follow the instructions for your specific operating system.

Here are the basic steps for installing Docker on most systems:

  • Download the Docker installer from the Docker website: docker-desktop

  • Run the installer and follow the prompts to install Docker

  • Start the Docker application

  • Once Docker is running, you can verify the installation by running the following command:

docker run hello-world
Enter fullscreen mode Exit fullscreen mode

Sign up/Sign in docker hub

  • To push a Docker image to Docker Hub, you will need to have an account on Docker Hub and be logged in

  • Open Docker Application

  • Click on 'Sign up'
    Image description

  • It will redirect into 'https://hub.docker.com', If you already have a account it it atomic login and redirect into docker application. Otherwise sign up into docker hub

Check Docker Image

  • Open terminal and run docker images, currently i have one image which is HelloWorld
docker images
Enter fullscreen mode Exit fullscreen mode

Image description

Push Docker Image into Docker Hub

  • Before you can push an image to Docker Hub, you will need to tag the image with the docker tag command.

  • For example, to tag an image with the name "hello-world " and the tag "latest", you can use the following command:

docker tag hello-world:latest user_name/hello-world 
Enter fullscreen mode Exit fullscreen mode

Image description

  • This will add the "latest" tag to the "hello-world " image.

  • You can then use the docker push command to push the image to Docker Hub. you can use the following command:

docker push user_name/hello-world 
Enter fullscreen mode Exit fullscreen mode

Pull Docker image

  • Go to docker hub

  • Your image will store here

  • Click on "Public view"

Image description

  • Click 'Public view'

  • Copy the link and share your team members to pull the image

Image description
Video - https://www.youtube.com/watch?v=EIHY_CY5J0k

Top comments (0)