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
.
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
.