Clone docker image to dockerhub account

sof picture sof · Aug 14, 2014 · Viewed 10.2k times · Source

Let's say one of the official docker base images ubuntu:latest and I have a dockerhub account myaccount. How to clone ubuntu:latest to myaccount'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 delta latest-new minus latest.

Answer

Andy picture Andy · Aug 14, 2014

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.