How to Pull all docker container images from docker repo at once?

Viewed 13477

I have a private docker repo in which i have 10 container images stored. I want to pull all images to a machine. is there a way i can pull all images from a repo with a single command? some command like

docker pull  xx.xx.com/reponame/* 

while researching I found ways to pull all tags of a single image; but no luck so far on all images

7 Answers

Use the format tag to filter the repository list. Although this will only pull the ones already existing in your host.

for image in $(docker images --format "{{.Repository}}"); do docker pull $image; done

Regarding the docker documentation of the command: docker pull, you could use the option

--all-tags

to download all tagged images in the repository.

In your case, it would be :

docker pull --all-tags  xx.xx.com/reponame 

Run below shell script to pull ALL DOCKER IMAGES with ALL TAGS from a Docker Registry at once,

SHELL SCRIPT:

#/bin/bash
set-x
registry="registry name/ip:port"
repos=`curl -u cloudfx:cFx2018Aug http://$registry/v2/_catalog?n=300 | jq '.repositories[]' | tr -d '"'`
for repo in $repos; do 
   docker pull --all-tags $registry/$repo;
done
Related