extract and flatten Docker image layers
Project description
Status
Curious about integrating your project with the above services? Jeff Knupp (@jeffknupp) describes how.
Notice
Copyright © 2014-2015 Matt Bogosian (@posita).
Please see the LICENSE (or LICENSE.txt) file which accompanied this software for rights and restrictions governing its use. All rights not expressly waived or licensed are reserved. If such a file did not accompany this software, then please contact the author before viewing or using this software in any capacity.
TL;DR
dimgx extracts and flattens Docker image layers:
% dimgx
usage:
dimgx [options] [-l LAYER_SPEC] ... [-t PATH] IMAGE_SPEC
dimgx -h # for help
dimgx: error: too few arguments
% dimgx nifty-box # show layers for "nifty-box[:latest]"
IMAGE ID PARENT ID CREATED LAYER SIZE VIRTUAL SIZE
3cb35ae859e7 - 16 days ago 125.1 MB 125.1 MB
41b730702607 3cb35ae859e7 16 days ago 0 Bytes 125.1 MB
60aa72e3db11 41b730702607 7 days ago 0 Bytes 125.1 MB
390ac3ff1e87 60aa72e3db11 6 days ago 1.7 kB 125.1 MB
fec4e64b2b57 390ac3ff1e87 6 days ago 9.4 MB 134.5 MB
51a39b466ad7 fec4e64b2b57 6 days ago 0 Bytes 134.5 MB
0bb92bb75744 51a39b466ad7 4 days ago 1.7 kB 134.5 MB
% dimgx -l 2:4 nifty-box # show only the second through fourth layers
IMAGE ID PARENT ID CREATED LAYER SIZE VIRTUAL SIZE
60aa72e3db11 41b730702607 7 days ago 0 Bytes 0 Bytes
390ac3ff1e87 60aa72e3db11 6 days ago 1.7 kB 1.7 kB
fec4e64b2b57 390ac3ff1e87 6 days ago 9.4 MB 9.4 MB
% dimgx -l 2:4 -t nifty.tar nifty-box # extract them
% du -h nifty.tar
9.0M nifty.tar
It is licensed under the MIT License. See the docs for more information.
Submissions
dimgx does what I want, so I’m just maintaining it at this point. If you find a bug, or want a feature, please file an issue (if it hasn’t already been filed). If you’re willing and able, consider submitting a pull request (PR) with a fix. There are only a few guidelines:
Try to follow the source conventions as you observe them. (Note: I have purposely avoided aspects of PEP8, in part because I have adopted conventions developed from my experiences with other languages, but mostly because I’m growing older and more stubborn.)
Provide unit tests where feasible and appropriate. Tests can be run with ./runtests.sh (requires tox) or python setup.py test.
If you need me, mention me (@posita) in your comment, and describe specifically how I can help.
If you want feedback on a work-in-progress (WIP), create a PR and prefix its title with something like, “NEED FEEDBACK -“.
If your PR is still in progress, but you aren’t blocked on anything, prefix the title with something like, “WIP -“.
Once you’re ready for a merge, resolve any merge conflicts, squash your commits, and provide a useful commit message. [1] Then prefix the PR’s title to something like, “READY FOR MERGE -“. I’ll try to get to it as soon as I can.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.