Clone docker image to dockerhub account
12,909
Solution 1
Use docker tag ubuntu:latest myaccount/ubuntu:latest
. (you should also tag with a specific version number so that you can still reference the image when you update :latest)
Then docker push myaccount/ubuntu
.
It won't actually make a copy, but it will add the new tag to the existing image. Other people won't see the tag unless they docker pull myaccount/ubuntu
.
Solution 2
Macos Use the command
$ docker pull NAME:tag
$ docker tag NAME:tag myaccount/name:tag
$ docker login
# yourname
# password
$ docker push myaccount/name:tag
Related videos on Youtube
Author by
sof
Updated on June 04, 2022Comments
-
sof almost 2 years
Let's say one of the official
docker
base imagesubuntu:latest
and I have adockerhub
accountmyaccount
. How to cloneubuntu:latest
tomyaccount
's repository? The work flow can then be introduced as follows,$ docker pull myaccount/ubuntu:latest $ docker run -it myaccount/ubuntu:latest /bin/bash # root@mycontainer: apt-get install onepackage # root@mycontainer: exit $ docker commit mycontainer myaccount/ubuntu:latest-new $ docker push myaccount/ubuntu:latest-new
I need
push
just the deltalatest-new
minuslatest
.-
Tarun Lalwani almost 7 yearsYou should not make changes manually by going in container and then making changes and committing the image. This doesn't preserver the metadata changes. And your history won't show the changes. So always use a Dockefile to make changes on top of another image that you want to customize. Rest your main question is answered by @Andy
-
-
sof almost 10 yearsWhat I expect is that dockerhub can provide us with the analogical function of github
fork
. -
sof almost 10 yearsAlthough what dockerhub does is more verbose that githhub
fork
, it satisfiesdelta push
. Accepted. -
sof almost 10 yearsOh, it's just a tagged link. Will the target repository on dockerhub become broken if the linked source is removed by chance?
-
Andy almost 10 yearsEmpirically testing, it looks like deleting the source repository does not affect the image in the "aliased" repository. I believe this is because both are actually aliases and neither is considered the canonical source. The persistence of referent image in the Docker Registry seems independent of the tagged names/aliases. At least that's the current behavior.
-
Peter H. Boling over 2 yearsThis doesn't answer the complete question, which includes adding a package to the cloned image. I have the same question, and nothing in this SO directly explains how to do that. It seems this writeup gives two methods for achieving the modification aspect: linuxhandbook.com/modifying-docker-image