Skip to content

Instantly share code, notes, and snippets.

@twaugh
Created March 11, 2016 16:22
Show Gist options
  • Save twaugh/b1cf30fbfa897d301ac0 to your computer and use it in GitHub Desktop.
Save twaugh/b1cf30fbfa897d301ac0 to your computer and use it in GitHub Desktop.
# docker build -t test --rm .
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM fedora
---> ddd5c9c1d0f2
Step 2 : RUN touch /tmp/test1
---> Running in 67eb98984603
---> 4183e0008378
Removing intermediate container 67eb98984603
Step 3 : RUN touch /tmp/test2
---> Running in 61f742cdb8dc
---> 7ef43f3ea837
docker history Removing intermediate container 61f742cdb8dc
Step 4 : CMD /bin/env
test ---> Running in 0b94f34b4e60
---> 63ce5f161a39
Removing intermediate container 0b94f34b4e60
Step 5 : LABEL foo bar
---> Running in 04631e3c7027
---> 9e19449922e7
Removing intermediate container 04631e3c7027
Successfully built 9e19449922e7
# docker-scripts -v squash test -t test:squashed -f 4
2016-03-11 16:17:17,494 root DEBUG Running version 1.0.0a1
2016-03-11 16:17:17,494 docker.auth.auth DEBUG File doesn't exist
2016-03-11 16:17:17,507 requests.packages.urllib3.connectionpool DEBUG "GET /version HTTP/1.1" 200 208
2016-03-11 16:17:17,508 requests.packages.urllib3.connectionpool DEBUG "GET /v1.22/_ping HTTP/1.1" 200 2
2016-03-11 16:17:17,510 requests.packages.urllib3.connectionpool DEBUG "GET /v1.22/version HTTP/1.1" 200 208
2016-03-11 16:17:17,510 root INFO docker-scripts version 1.0.0a1, Docker c3959b1, API 1.22...
2016-03-11 16:17:17,510 root INFO Using v2 image format
2016-03-11 16:17:17,511 root DEBUG Using /tmp/docker-squash-atYt7c as the temporary directory
2016-03-11 16:17:17,512 requests.packages.urllib3.connectionpool DEBUG "GET /v1.22/images/test/json HTTP/1.1" 200 1610
2016-03-11 16:17:17,516 requests.packages.urllib3.connectionpool DEBUG "GET /v1.22/images/sha256%3A9e19449922e70f1c829522f628b0414450be40dc6a64408fc5a239eed1dfebb1/history HTTP/1.1" 200 1203
2016-03-11 16:17:17,516 root INFO Old image has 6 layers
2016-03-11 16:17:17,516 root DEBUG Old layers: [u'<missing>', u'sha256:ddd5c9c1d0f2a08c5d53958a2590495d4f8a6166e2c1331380178af425ac9f3c', u'sha256:4183e0008378bc2db12874d881525af4d99224f573fd5ba515ae5dee9516a819', u'sha256:7ef43f3ea8371ddcd9fff6ad7de91f2d1f3ce7ca05ab270bccd60f698bc0cf37', u'sha256:63ce5f161a399de9741b17bf353626318ddcade446cab5ae8b6423e7e1223a50', u'sha256:9e19449922e70f1c829522f628b0414450be40dc6a64408fc5a239eed1dfebb1']
2016-03-11 16:17:17,516 root INFO Checking if squashing is necessary...
2016-03-11 16:17:17,516 root INFO Attempting to squash last 4 layers...
2016-03-11 16:17:17,516 root DEBUG Layers to squash: [u'sha256:63ce5f161a399de9741b17bf353626318ddcade446cab5ae8b6423e7e1223a50', u'sha256:9e19449922e70f1c829522f628b0414450be40dc6a64408fc5a239eed1dfebb1']
2016-03-11 16:17:17,516 root INFO Saving image sha256:9e19449922e70f1c829522f628b0414450be40dc6a64408fc5a239eed1dfebb1 to /tmp/docker-squash-atYt7c/old/image.tar file...
2016-03-11 16:17:17,516 root DEBUG Try #1...
2016-03-11 16:17:25,553 requests.packages.urllib3.connectionpool DEBUG "GET /v1.22/images/sha256%3A9e19449922e70f1c829522f628b0414450be40dc6a64408fc5a239eed1dfebb1/get HTTP/1.1" 200 None
2016-03-11 16:17:28,859 root INFO Image saved!
2016-03-11 16:17:28,862 root INFO Unpacking /tmp/docker-squash-atYt7c/old/image.tar tar file to /tmp/docker-squash-atYt7c/old directory
2016-03-11 16:17:30,341 root DEBUG Removing exported tar (/tmp/docker-squash-atYt7c/old/image.tar)...
2016-03-11 16:17:30,369 root INFO Archive unpacked!
2016-03-11 16:17:30,370 root INFO Squashing image 'test'...
2016-03-11 16:17:30,370 root DEBUG Reading '/tmp/docker-squash-atYt7c/old/manifest.json' JSON file...
2016-03-11 16:17:30,370 root DEBUG Reading '/tmp/docker-squash-atYt7c/old/9e19449922e70f1c829522f628b0414450be40dc6a64408fc5a239eed1dfebb1.json' JSON file...
2016-03-11 16:17:31,430 root DEBUG Moving unmodified layer '768d4f50f65f00831244703e57f64134771289e3de919a576441c9140e037ea2'...
2016-03-11 16:17:31,430 root DEBUG Moving unmodified layer 'c9e8e107e6bdba9bf977ecaeb8e7bcb9f5d9d504dc8dc7a0d632b704b0ab0902'...
2016-03-11 16:17:31,431 root DEBUG Moving unmodified layer '38f7464aaaae0a27bd1e2b05cb712462c1d88bb4173d4a528f964bbb0801c6ea'...
2016-03-11 16:17:31,431 root DEBUG Moving unmodified layer '6b1d49b5d5d1432ea6a7ed30e0c1f43ede7eb2bd3b9d40528b71143820a6aca0'...
2016-03-11 16:17:31,431 root INFO New squashed image ID is dde91ed37ec5626f2095cbbc9e98f6f79be756c414669e38a94696d07fa2cc09
2016-03-11 16:17:31,431 root DEBUG Generating tar archive for the squashed image...
2016-03-11 16:17:31,548 root DEBUG Archive generated
2016-03-11 16:17:31,549 root DEBUG Loading squashed image...
2016-03-11 16:17:41,134 requests.packages.urllib3.connectionpool DEBUG "POST /v1.22/images/load HTTP/1.1" 200 157
2016-03-11 16:17:41,140 root DEBUG Image loaded!
2016-03-11 16:17:41,154 root INFO Image registered in Docker daemon as test:squashed
2016-03-11 16:17:41,157 root INFO Done
do[root@osbs test]# docker history test:squashed
IMAGE CREATED CREATED BY SIZE COMMENT
dde91ed37ec5 26 seconds ago 0 B
<missing> About a minute ago /bin/sh -c touch /tmp/test2 0 B
<missing> About a minute ago /bin/sh -c touch /tmp/test1 0 B
<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