Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clone docker image to dockerhub account

Tags:

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.

like image 392
sof Avatar asked Aug 14 '14 14:08

sof


People also ask

How do I push an image into Docker Hub?

To push an image to Docker Hub, you must first name your local image using your Docker Hub username and the repository name that you created through Docker Hub on the web. You can add multiple images to a repository by adding a specific :<tag> to them (for example docs/base:testing ).

Do I need to login to Docker Hub to pull the images?

Run docker build -t <your_username>/my-private-repo . to build your Docker image. Run docker run <your_username>/my-private-repo to test your Docker image locally. You must be signed in to Docker Hub through Docker Desktop or the command line, and you must also name your images correctly, as per the above steps.

Does Docker Hub store images or containers?

Docker Hub is a cloud-based repository in which Docker users and partners create, test, store and distribute container images.

How do I copy a docker image from one registry to another?

In order to transfer a Docker image from one server to another, what you need to do is first export the image to a file, then copy that file over from your current server to the new one using scp or rsync and finally load the image to your new server.


2 Answers

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.

like image 91
Andy Avatar answered Sep 20 '22 19:09

Andy


Macos Use the command

$    docker pull NAME:tag $    docker tag NAME:tag myaccount/name:tag $    docker login #    yourname #    password $    docker push myaccount/name:tag 
like image 43
Be Live Avatar answered Sep 21 '22 19:09

Be Live