Skip to content

Instantly share code, notes, and snippets.

@stanislavb
Created July 11, 2015 22:21
Show Gist options
  • Save stanislavb/80b04e5ed09b239a8b1d to your computer and use it in GitHub Desktop.
Save stanislavb/80b04e5ed09b239a8b1d to your computer and use it in GitHub Desktop.
Get Docker image object
#!/usr/bin/env python
import argparse
from docker import Client
import json
if __name__ == "__main__":
c = Client(base_url='unix://var/run/docker.sock')
parser = argparse.ArgumentParser()
parser.add_argument('image')
args = parser.parse_args()
images=c.images(name=args.image)
print(json.dumps(images, indent=4, sort_keys=True))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment