Working With Docker-Hub

Vikas Tiwari
3 min readApr 28, 2021

Let’s push and pull images from and on the machines

In this blog, we will see how to utilize the Docker hub to push and pull the images.

Before starting once take a look at this blog https://tiwarivikas.medium.com/docker-tutorial-for-beginners-8af6a4967378

  • goto https://hub.docker.com/, create an account, and select the free pack to get started.
  • Click on create a repository
  • Fill the name as docker-app and create the repository
  • Now follow step 1 to step 4 from here under the “Working with Docker” section.
  • After you have your application ready with all the instructions in the Dockerfile.
  • Login into Docker Hub from terminal
$ sudo docker login
  • Let’s build it.

In the tagline, we are required to mention our username/image-name

$ sudo docker build -t yourusername/docker-app
  • Run the below command to list the images. You can see the recently build image in the list.
$ sudo docker image ls
  • Let’s push the image in the Docker Hub :)
$ sudo docker push yourusername/docker-app
  • go to the Docker Hub and check the repository to confirm that the image is pushed.

Now let’s see how to pull an image from the Docker Hub and run it virtually.

To demonstrate this I will use Docker Playground

  • Add a new instance.
  • After that one sandbox environment will be created for us to work.
  • Click on terminal and hit alt+enter to maximize it and enter the below command.
$ docker version
  • Let’s pull the image.
$ docker pull yourusername/docker-app
  • Let’s verify it.
$ docker image ls
  • Let’s run it.
$ docker run yourusername/docker-app

Conclusion

We saw how to utilize the Docker hub to push and pull images with some other basic commands. Hope you enjoyed this blog, If you did make sure to take a look on my YouTube channel for more amazing stuff, let’s catch up on the next blog soon.

--

--