DEV Community

Cover image for #012 Upload to Docker hub
Omar
Omar

Posted on

#012 Upload to Docker hub

Introduction

this is part 12 from the journey it's a long journey(360 day) so go please check previous parts , and if you need to walk in the journey with me please make sure to follow because I may post more than once in 1 Day but surely I will post daily at least one 😍.

And I will cover lot of tools as we move on.


Preparation

first login

docker login
ls ~/.docker
Enter fullscreen mode Exit fullscreen mode

login

you only need to login once the docker will be saved locally inside home/username/.docker/config.json

now let's prepare our image to uploaded it

docker image tag app_009_1 your_username_here/app_009_1:latest
docker image ls
Enter fullscreen mode Exit fullscreen mode

tag

replace your_username_here with your account username.
we can notice both have same image ID this what tag do
it link a new image with a new tag to an old one.

now after we have image ready let's move to next step.


Upload it

docker image push your_username_here/app_009_1:latest
Enter fullscreen mode Exit fullscreen mode

again replace your_username_here with your account username.
in my case it's omarelkhatib

push

and done it's now on docker hub easy!!


Get it from the hub again

go to "My Profile"
profile

and here we find it!

image_hub

click on it

closer_look

now it's time to clear the image and get it this time from the hub

image_ls

first run

docker image ls
Enter fullscreen mode Exit fullscreen mode

copy first 4 letters of IMAGE ID

docker image rm -f c3a5
Enter fullscreen mode Exit fullscreen mode

c3a5 are first 4 letters

rm -f it's force delete so if it's referenced to a container it will force delete it.

now run again

docker image ls
Enter fullscreen mode Exit fullscreen mode

removed
as we see they got removed

to get it from docker hub run

docker pull your_username_here/app_009_1
Enter fullscreen mode Exit fullscreen mode

Again replace your_username_here with your username

Alt Text

docker image ls
Enter fullscreen mode Exit fullscreen mode

and voila! we got our image from the hub :)

Top comments (2)

Collapse
 
linuxxraza profile image
Hassan raza

just loved it, can i make a video on this topic? and helping others as well

Collapse
 
omarkhatib profile image
Omar

yes for sure!