Docker Hub is a service which enables you to find and share container images with your team. Any one can sign up to the Docker Hub and create your own repository, public or private. Lets build and push a container image to Docker hub.
- Create a docker file with below content.
FROM busybox
CMD echo “Hello World..First docker image” - Run the docker build command to create docker image and then run image to test:
docker build -t username/repo
docker run username/repo - Push your Docker image to Docker hub:
login to Docker Hub, #docker login
#docker push <username>/repo - Finally, we can login to Docker Hub portal and check the image we uploaded to the repository.
Conclusion: The above article displayed the process of creating a docker image on the local computer using Dockerfile and then creating a new repository in Docker Hub and pushing the Docker image in the repository.