Push all the images from a local registry to DockerHub in one go

The other day, I wanted to push all the images from my local Docker registry to the Docker Hub but I didn't want to do it manually so I wrote this bash shell script:



What the script's doing basically:

1. Get all the images in the local registry, assuming the image's name is in  this form: 

local.registry.domain/branch/image_name:my-tag

2. For each image, create a new tag that match DockerHub's requirement which is:

docker_hub_username/my-tag

3. Then push that image into Docker Hub

Here is my Docker Hub repositories after finish the PUSH, you can have a look:

https://hub.docker.com/u/dangtrinhnt/

Profit!

Comments