Reputation: 43391
I'm migrating a project from a private registry to hub.docker.com but I don't have all tagged image on computer.
I have access to the registry machine via SSH.
How can I push all my registry images to hub.docker.com?
Upvotes: 0
Views: 1032
Reputation: 5027
Access to your registry machine via SSH, use docker login
to login inside your Docker Hub account, add a tag to your images which points to Docker Hub docker tag my_own_registry.com/image:tag user/image:tag
a then push that new tag using docker push user/image:tag
.
@zigarn script automates this job.
Edit: You commented that your bandwith is bad, then you can access via ssh to your registry machine, save your image using docker save
, then copy it to your machine and load it by docker load
and finally push it to Docker Hub as explained above.
Upvotes: 0
Reputation: 11595
I think that the only way is to pull them all, then retag them and push to hub.docker.com
You can script it with something like:
for repository in $(curl -s http://localhost:5000/v2/_catalog | jq -r '.repositories[]'); do
for image in $(curl -s http://localhost:5000/v2/${repository}/tags/list | jq -r '(.name + ":" + .tags[])')
docker image pull localhost:5000/${image}
docker image tag localhost:5000/${image} <YOUR_HUB_PREFIX>/${image}
docker image push <YOUR_HUB_PREFIX>/${image}
# if you need some cleanup
docker image rm localhost:5000/${image} <YOUR_HUB_PREFIX>/${image}
done
done
Upvotes: 2