Skip to content

Instantly share code, notes, and snippets.

@justone
Last active March 17, 2016 15:33
Show Gist options
  • Save justone/933cd36d92f763bfb45c to your computer and use it in GitHub Desktop.
Save justone/933cd36d92f763bfb45c to your computer and use it in GitHub Desktop.
Docker Size and VirtualSize reported differently on v1.9 and v1.10
$ docker version
Client:
Version: 1.10.1
API version: 1.22
Go version: go1.5.3
Git commit: 9e83765
Built: Thu Feb 11 19:27:08 2016
OS/Arch: linux/amd64
Server:
Version: 1.10.1
API version: 1.22
Go version: go1.5.3
Git commit: 9e83765
Built: Thu Feb 11 19:27:08 2016
OS/Arch: linux/amd64
$ docker build -t newimage .
Sending build context to Docker daemon 2.56 kB
Step 1 : FROM alpine
---> 70c557e50ed6
Step 2 : LABEL FOO Bar
---> Running in 2ee44a845a12
---> 68b00a004e35
Removing intermediate container 2ee44a845a12
Successfully built 68b00a004e35
$ docker run -v /var/run/docker.sock:/var/run/docker.sock nate/dockviz images --incremental --tree alpine
└─sha256:70c55 Virtual Size: 4.8 MB Tags: alpine:latest
└─sha256:68b00 Virtual Size: 4.8 MB Tags: newimage:latest
[
{
"Id": "sha256:68b00a004e355c630bce05c703d5972490d38a3e9bc2e24ef1861a724166bd1c",
"ParentId": "sha256:70c557e50ed630deed07cbb0dc4d28aa0f2a485cf7af124cc48f06bce83f784b",
"RepoTags": [
"newimage:latest"
],
"RepoDigests": null,
"Created": 1458227249,
"Size": 4797951,
"VirtualSize": 4797951,
"Labels": {
"FOO": "Bar"
}
}
]
$ docker version
Client:
Version: 1.9.1
API version: 1.21
Go version: go1.4.3
Git commit: a34a1d5
Built: Fri Nov 20 17:56:04 UTC 2015
OS/Arch: linux/amd64
Server:
Version: 1.9.1
API version: 1.21
Go version: go1.4.3
Git commit: a34a1d5
Built: Fri Nov 20 17:56:04 UTC 2015
OS/Arch: linux/amd64
$ docker build -t newimage .
Sending build context to Docker daemon 2.56 kB
Step 1 : FROM alpine
---> 9a686d8dd34c
Step 2 : LABEL FOO Bar
---> Running in 675db9644411
---> 28c756c523fc
Removing intermediate container 675db9644411
Successfully built 28c756c523fc
$ docker run -v /var/run/docker.sock:/var/run/docker.sock nate/dockviz images --incremental --tree alpine
└─9a686d8dd34c Virtual Size: 4.8 MB Tags: alpine:latest
└─28c756c523fc Virtual Size: 0.0 B Tags: newimage:latest
$ echo -e "GET /images/json?all=1 HTTP/1.0\r\n" | nc -U /var/run/docker.sock | tail -n 1 | jq '. | map(select(.RepoTags[] | contains ("newimage:latest")))'
[
{
"Id": "28c756c523fca866d4b15ef62fe70c6b4f1ad95bfa45f2c54070b9fb129ad64b",
"ParentId": "9a686d8dd34c0a9d62c9f4df0347096ab3babe858e40a29c144d2033b63a33eb",
"RepoTags": [
"newimage:latest"
],
"RepoDigests": [],
"Created": 1458227155,
"Size": 0,
"VirtualSize": 4797951,
"Labels": {
"FOO": "Bar"
}
}
]
FROM alpine
LABEL FOO=Bar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment