Introduction

I have seen the repeated solution on docker help pages which helps to push your image to your username. Example:

First build the image
docker build -t <my_image_name> .

Tag the image, by seeing its image id, from docker images command
docker tag 04d7cc352e96 <username>/<my_image_name>:<tag>

Finally, push your image
docker push <username>/<my_image_name>
</my_image_name></username></tag></my_image_name></username></my_image_name>

Problem

With above approach, the image will be pushed in path: //

Example:

If my username is: goravsingal, and my_image_name=php-apache-mongo

The image will not be published in organization’s space. Rather in user’s space.

Solution

First build the image
docker build -t <my_image_name> .

Tag the image, by seeing its image id, from docker images command
docker tag 04d7cc352e96 <organization_name>/<my_image_name>:<tag>

Finally, push your image
docker push <organization_name>/<my_image_name>
</my_image_name></organization_name></tag></my_image_name></organization_name></my_image_name>

Example:

My org name is: gyanblog, my_image_name is php-apache-mongo

Build Image
docker build -t php-apache-mongo .

Tag image
docker tag 04d7cc352e96 gyanblog/php-apache-mongo:latest

Push in organization
docker push gyanblog/php-apache-mongo

Finally, my path becomes:https://hub.docker.com/r/gyanblog/php-apache-mongo/

Bingo!