Learn docker : a Beginner’s Guide to Pushing and Pulling Images from Docker Hub

Rabie Ouallaf
3 min readFeb 12, 2024

--

Introduction :

If you are new to docker , It’s simply a tool to containerize and isolate software in order to prevent OS conflicts between development machine and also time consuming issues. furthermore , docker helps to easily ship , deploy our applications.

In the other hand , docker hub is basically a cloud-based registry platform that serves as a central hub for sharing and distributing docker images

Without any further say let’s dive into the guide.

Starting with what does push and pull refers to in the context of docker.

Push : Pushing a Docker image means uploading it from your local environment to a container registry, making it available for others to use.

Pull : Pulling a Docker image means downloading it from a container registry to your local environment, making it ready for use on your machine or server.

Now after giving a definition to docker , docker hub , push and pull in the realm of docker we could start the process.

Step 1 : Create an account

Start by creating an account in docker hub website or login to you’re existing account if you have one.

Step 2 : Login to your docker hub account from terminal

Run the following command :

docker login

and then enter you’re credentials.

Step 3 : Tag the image

run the following command to see docker images in your machine

docker images

the output should look somewhat like that :

chose the image you want to push to docker hub and run the following command to tag it :

docker tag <image name>:<version> <your docker hub username>/<image name>:<version(latest by default)>

in my case that’s how the command looks like :

docker tag myrh-backend-spring-app:latest rabieouallaf/myrh-backend-spring-app

Step 4 : Push the image

After tagging an image now it’s time to push it to docker hub , I have some good news ! it’s too simple

just run the following command :

docker push <image>

In my case the command looks like this :

docker push rabieouallaf33/myrh-backend-spring-app

finally 🎉 the image is pushed successfully :

How I can pull it now ?

Basically run the following command :

docker pull <image>

in my case the command looks like this :

docker pull rabieouallaf33/myrh-backend-spring-app 

Congratulations , you’ve just made it ! 🎉

Conclusion :

Nevertheless , docker is one of the key technologies in today’s digital world especially in the realm of DevOps , so acquiring skills and knowledge in this area is definitely helpful and time worthy.

--

--