Skip to content

Instantly share code, notes, and snippets.

@twaugh
Created March 11, 2016 16:32
Show Gist options
  • Save twaugh/ac6e7a9df99e0e0fcb85 to your computer and use it in GitHub Desktop.
Save twaugh/ac6e7a9df99e0e0fcb85 to your computer and use it in GitHub Desktop.
More squash testing
# cat Dockerfile
FROM fedora
RUN dnf install -y ghostscript-core
CMD /bin/env
LABEL foo=bar
# docker history test
IMAGE CREATED CREATED BY SIZE COMMENT
22eda7db9190 About a minute ago /bin/sh -c #(nop) LABEL foo=bar 0 B
caf22047c227 About a minute ago /bin/sh -c #(nop) CMD ["/bin/sh" "-c" "/bin/e 0 B
fc675bf644f1 About a minute ago /bin/sh -c dnf install -y ghostscript-core 199.5 MB
ddd5c9c1d0f2 6 days ago /bin/sh -c #(nop) ADD file:bcb5e5cddd4c4d1cac 204.7 MB
<missing> 6 days ago /bin/sh -c #(nop) MAINTAINER Patrick Uiterwij 0 B
# docker-scripts -v squash test -t test:squashed -f 3
2016-03-11 16:29:53,293 root DEBUG Running version 1.0.0a1
2016-03-11 16:29:53,293 docker.auth.auth DEBUG File doesn't exist
2016-03-11 16:29:53,302 requests.packages.urllib3.connectionpool DEBUG "GET /version HTTP/1.1" 200 208
2016-03-11 16:29:53,304 requests.packages.urllib3.connectionpool DEBUG "GET /v1.22/_ping HTTP/1.1" 200 2
2016-03-11 16:29:53,305 requests.packages.urllib3.connectionpool DEBUG "GET /v1.22/version HTTP/1.1" 200 208
2016-03-11 16:29:53,306 root INFO docker-scripts version 1.0.0a1, Docker c3959b1, API 1.22...
2016-03-11 16:29:53,306 root INFO Using v2 image format
2016-03-11 16:29:53,307 root DEBUG Using /tmp/docker-squash-Xomviq as the temporary directory
2016-03-11 16:29:53,309 requests.packages.urllib3.connectionpool DEBUG "GET /v1.22/images/test/json HTTP/1.1" 200 1610
2016-03-11 16:29:53,314 requests.packages.urllib3.connectionpool DEBUG "GET /v1.22/images/sha256%3A22eda7db9190942c7fc4eb105cf2c1fe367dc224b13e2b40d44c443303b3a99b/history HTTP/1.1" 200 1048
2016-03-11 16:29:53,315 root INFO Old image has 5 layers
2016-03-11 16:29:53,315 root DEBUG Old layers: [u'<missing>', u'sha256:ddd5c9c1d0f2a08c5d53958a2590495d4f8a6166e2c1331380178af425ac9f3c', u'sha256:fc675bf644f1996af08f9e81ee3209e5d0d0df5ea58b015651562e5f9ec68e3a', u'sha256:caf22047c2278c7e154580dd833e3558d10b92fd26ad3ea0d34c9d85308f7054', u'sha256:22eda7db9190942c7fc4eb105cf2c1fe367dc224b13e2b40d44c443303b3a99b']
2016-03-11 16:29:53,315 root INFO Checking if squashing is necessary...
2016-03-11 16:29:53,315 root INFO Attempting to squash last 3 layers...
2016-03-11 16:29:53,315 root DEBUG Layers to squash: [u'sha256:caf22047c2278c7e154580dd833e3558d10b92fd26ad3ea0d34c9d85308f7054', u'sha256:22eda7db9190942c7fc4eb105cf2c1fe367dc224b13e2b40d44c443303b3a99b']
2016-03-11 16:29:53,315 root INFO Saving image sha256:22eda7db9190942c7fc4eb105cf2c1fe367dc224b13e2b40d44c443303b3a99b to /tmp/docker-squash-Xomviq/old/image.tar file...
2016-03-11 16:29:53,315 root DEBUG Try #1...
2016-03-11 16:30:01,720 requests.packages.urllib3.connectionpool DEBUG "GET /v1.22/images/sha256%3A22eda7db9190942c7fc4eb105cf2c1fe367dc224b13e2b40d44c443303b3a99b/get HTTP/1.1" 200 None
2016-03-11 16:30:12,908 root INFO Image saved!
2016-03-11 16:30:12,967 root INFO Unpacking /tmp/docker-squash-Xomviq/old/image.tar tar file to /tmp/docker-squash-Xomviq/old directory
2016-03-11 16:30:15,841 root DEBUG Removing exported tar (/tmp/docker-squash-Xomviq/old/image.tar)...
2016-03-11 16:30:15,878 root INFO Archive unpacked!
2016-03-11 16:30:15,878 root INFO Squashing image 'test'...
2016-03-11 16:30:15,879 root DEBUG Reading '/tmp/docker-squash-Xomviq/old/manifest.json' JSON file...
2016-03-11 16:30:15,881 root DEBUG Reading '/tmp/docker-squash-Xomviq/old/22eda7db9190942c7fc4eb105cf2c1fe367dc224b13e2b40d44c443303b3a99b.json' JSON file...
2016-03-11 16:30:17,944 root DEBUG Moving unmodified layer '768d4f50f65f00831244703e57f64134771289e3de919a576441c9140e037ea2'...
2016-03-11 16:30:17,944 root DEBUG Moving unmodified layer 'c9e8e107e6bdba9bf977ecaeb8e7bcb9f5d9d504dc8dc7a0d632b704b0ab0902'...
2016-03-11 16:30:17,945 root DEBUG Moving unmodified layer '7c0d2fe586d71e85dfd2f214bf23b08e0751b51dc93a857e60ba9f7c519036cb'...
2016-03-11 16:30:17,945 root INFO New squashed image ID is 3f72f96f07b9b95c4fe7194fb5d8827b525e22ecb338348d2e35fe0bb468ac16
2016-03-11 16:30:17,945 root DEBUG Generating tar archive for the squashed image...
2016-03-11 16:30:18,229 root DEBUG Archive generated
2016-03-11 16:30:18,229 root DEBUG Loading squashed image...
2016-03-11 16:30:37,997 requests.packages.urllib3.connectionpool DEBUG "POST /v1.22/images/load HTTP/1.1" 200 0
2016-03-11 16:30:38,092 root DEBUG Image loaded!
2016-03-11 16:30:38,137 root INFO Image registered in Docker daemon as test:squashed
2016-03-11 16:30:38,147 root INFO Done
# docker history test:squashed
IMAGE CREATED CREATED BY SIZE COMMENT
3f72f96f07b9 About a minute ago 0 B
<missing> 3 minutes ago /bin/sh -c dnf install -y ghostscript-core 199.5 MB
<missing> 6 days ago /bin/sh -c #(nop) ADD file:bcb5e5cddd4c4d1cac 204.7 MB
<missing> 6 days ago /bin/sh -c #(nop) MAINTAINER Patrick Uiterwij 0 B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment