Once you have create am image your next option is to publish the created Docker image on the Docker Hub Repository. To do so, you will need to create an account on the Docker Hub signup webpage where you will provide a name, password, and email address for your account. I should also point out that the Docker Hub service is free for public docker images. Once you have created your account, you can push the image that you have previously created, to make it available for others to use.
To do so, you will need the ID and the TAG of your “my-docker-whale” image.
Run again the “docker images” command and note the ID and the TAG of your Docker image e.g. a69f3f5e1a31.
Now, with the following command, we will prepare our Docker Image for its journey to the outside world (the accountname part of the command is your account name on the Docker Hube profile page):
docker tag a69f3f5e1a31 accountname/my-docker-whale:latest
Run the “docker images” command and verify your newly tagged image.
Next, use the “docker login” command to log into the Docker Hub from the command line.
The format for the login command is:
docker login –username=yourhubusername –email=youremail@provider.com
When prompted, enter your password and press enter.
Now you can push your image to the newly created repository:
docker push accountname/my-docker-whale
The above command can take a while to complete depending on your connection’s upload bandwidth as it uploads something like 180ΜΒ of data (in our example). Once it has completed, you can go to your profile on Docker Hub and check out your new image.