Created
October 26, 2015 05:58
-
-
Save praveenkumar/58c3fa833ea1e8a1d18a to your computer and use it in GitHub Desktop.
Pull all <images>:<tag> with latest build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Script to get pull all <images>:<tag> with latest build | |
import docker | |
import json | |
cli = docker.Client(base_url='unix://var/run/docker.sock') | |
repo_tags = [] | |
for image in cli.images(): | |
repo_tags.extend(image.get('RepoTags')) | |
for image in repo_tags: | |
for line in cli.pull(image, stream=True, insecure_registry=True): | |
print(json.dumps(json.loads(line), indent=4)) | |
# Run this script | |
# sudo python pull_latest_images.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment