Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pushing docker image to dockerhub

I ve created my own docker file ( that runs a shell script which prints "helloworld"). The image is "hellodocker" and the tag is "mytag" I now have:

bash-3.2$ docker images
REPOSITORY          TAG                   IMAGE ID            CREATED                 VIRTUAL SIZE
hellodocker         mytag                 3514c8dc11a8        39 minutes ago      2.433 MB
busybox             buildroot-2013.08.1   d200959a3e91        10 weeks ago        2.489 MB
busybox             ubuntu-14.04          37fca75d01ff        10 weeks ago        5.609 MB
busybox             ubuntu-12.04          fd5373b3d938        10 weeks ago        5.455 MB
busybox             buildroot-2014.02     a9eb17255234        10 weeks ago        2.433 MB
busybox             latest                a9eb17255234        10 weeks ago        2.433 MB

docker ps -a
CONTAINER ID        IMAGE                       COMMAND                CREATED             STATUS                        PORTS               NAMES
97c29510069e        hellodocker:mytag           /bin/sh -c /Users/in   33 minutes ago                  Exited (127) 26 minutes ago                       happy_pasteur       
8d04a1385c24        hellodocker:mytag           /bin/sh -c /Users/in   37 minutes ago      Exited (127) 30 minutes ago                       mad_bell            
8998d61c0513        hellodocker:mytag           /bin/sh -c /Users/in   37 minutes ago      Exited (127) 30 minutes ago                       boring_thompson         
64314c304a29        hellodocker:mytag           /bin/sh -c /Users/in   37 minutes ago      Exited (127) 31 minutes ago                       sad_wilson          
8bc20e0555b8        hellodocker:mytag           /bin/sh -c /Users/in   38 minutes ago      Exited (127) 31 minutes ago                       sleepy_mayer        
97664a4ba870        hellodocker:mytag           .                      38 minutes ago                                                        kickass_poincare    
8bb752631cb6        busybox:buildroot-2014.02   /bin/echo Hello Doct   18 hours ago        Exited (0) 18 hours ago                           dreamy_kowalevski   
6aa66b55ca94        busybox:buildroot-2014.02   bash-3.2$ sudo docke   18 hours ago                                                          ecstatic_lovelace   
2cc657f65342        busybox:buildroot-2014.02   /bin/echo Hello Dock   18 hours ago        Exited (0) 18 hours ago                           dreamy_poincare 

How do I push the docker image to dockerhub? I use docker push <myuserid>/hellodocker. This gives a 'no such id` error. What am I missing? Thanks in advance.

like image 247
user1189851 Avatar asked Aug 19 '14 16:08

user1189851


People also ask

How do I push a docker image to a private repository?

log in to your Docker Hub account and go to your Global settings . There is a setting that allows you to set what your default visibility is for the repositories that you push. By default it is set to public, but if you change it to private, all of your repositories that you push will be marked as private by default.


2 Answers

You either need to tag it as <myuser>/hellodocker when you build it, e g

docker build -t <myuser>/hellodocker:mytag .

or create a new tag tied to the same image, i e

docker tag hellodocker:mytag <myuser>/hellodocker:mytag
like image 173
frvi Avatar answered Oct 04 '22 11:10

frvi


If you want hellodocker repository under myuserid namespace, you have to first tag your local hellodocker to myuseridlike:

docker tag hellodocker myuserid/hellodocker

And then push this myuserid/hellodocker repository to hub like:

docker push myuserid/hellodocker

like image 44
Navid Avatar answered Oct 04 '22 12:10

Navid