Alright, if you are familiar with docker, docker-container and container image then you must have heard about docker hub.
Docker hub
Docker hub is a cloud based service to create, manage, test, deploy container application repositories. In simple, we can create a repository and we can push the container image in that repository. Public and Opensource repository can be used by anyone just by pulling image to the system. It is basically a hub for container images.
In the previous post, i have containerized react application and run the application through the container.
Lets get into the docker hub
To get started, make sure to create account in the docker hub. If you don't have docker hub account yet, visit Docker hub and create account first.
Create repository
View Repositories
Lets check container images in our system,
~ docker images
Our container image react-app
has a tag name latest
by default, so we can change it to our first tag name as v1
.
~ docker tag react-app:latest react-app:v1
Lets check container images again,
~ docker images
Or we can just build container image again by assigning tag name,
~ docker build -t react-app:v2 .
Lets check container images again,
~ docker images
Now we can tag local container image to remote repository
~ docker tag f8a7e190bb57 nirajpdn/react-app:v1
Lets publish image to the docker hub
Now, we can publish local container image to the docker hub with command:
~ docker push nirajpdn/react-app:v1
If you get an issue of denied: requested access to the resource is denied
and not able to push the image to the remote repository because we haven't logged in to docker hub from our system. Lets login with:
~ docker login
After successfully logged in to docker hub.
Lets do above docker push nirajpdn/react-app:v1
command again.
~ docker push nirajpdn/react-app:v1
Success 🎉 , lets check our remote repository.
We did it. Congratulations. 😄
We already have image with tag react-app:v2
in our local system. If you want to push that again with tag v2
in remote resository.
~ docker tag 0a67bb68a7fb nirajpdn/react-app:v2
Push the image again.
~ docker push nirajpdn/react-app:v2
Lets check remote repository again.
Keep doing.
Top comments (0)