Skip to content

Instantly share code, notes, and snippets.

@praveenkumar
Created October 26, 2015 05:58
Show Gist options
  • Save praveenkumar/58c3fa833ea1e8a1d18a to your computer and use it in GitHub Desktop.
Save praveenkumar/58c3fa833ea1e8a1d18a to your computer and use it in GitHub Desktop.
Pull all <images>:<tag> with latest build
#!/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