graph: exported images times matching creation#16076
Conversation
the image export, that is used in `docker save` previous has just had the layers times (atimes, mtimes) be when the save was done. ```bash vbatts@valse ~ (master) $ docker save busybox | tar tv drwxr-xr-x 0/0 0 2015-09-03 22:22 6ce2e90b0bc7224de3db1f0d646fe8e2c4dd37f1793928287f6074bc451a57ea/ -rw-r--r-- 0/0 3 2015-09-03 22:22 6ce2e90b0bc7224de3db1f0d646fe8e2c4dd37f1793928287f6074bc451a57ea/VERSION -rw-r--r-- 0/0 1405 2015-09-03 22:22 6ce2e90b0bc7224de3db1f0d646fe8e2c4dd37f1793928287f6074bc451a57ea/json -rw-r--r-- 0/0 2643968 2015-09-03 22:22 6ce2e90b0bc7224de3db1f0d646fe8e2c4dd37f1793928287f6074bc451a57ea/layer.tar drwxr-xr-x 0/0 0 2015-09-03 22:22 8c2e06607696bd4afb3d03b687e361cc43cf8ec1a4a725bc96e39f05ba97dd55/ -rw-r--r-- 0/0 3 2015-09-03 22:22 8c2e06607696bd4afb3d03b687e361cc43cf8ec1a4a725bc96e39f05ba97dd55/VERSION -rw-r--r-- 0/0 1346 2015-09-03 22:22 8c2e06607696bd4afb3d03b687e361cc43cf8ec1a4a725bc96e39f05ba97dd55/json -rw-r--r-- 0/0 1024 2015-09-03 22:22 8c2e06607696bd4afb3d03b687e361cc43cf8ec1a4a725bc96e39f05ba97dd55/layer.tar drwxr-xr-x 0/0 0 2015-09-03 22:22 cf2616975b4a3cba083ca99bc3f0bf25f5f528c3c52be1596b30f60b0b1c37ff/ -rw-r--r-- 0/0 3 2015-09-03 22:22 cf2616975b4a3cba083ca99bc3f0bf25f5f528c3c52be1596b30f60b0b1c37ff/VERSION -rw-r--r-- 0/0 1181 2015-09-03 22:22 cf2616975b4a3cba083ca99bc3f0bf25f5f528c3c52be1596b30f60b0b1c37ff/json -rw-r--r-- 0/0 1024 2015-09-03 22:22 cf2616975b4a3cba083ca99bc3f0bf25f5f528c3c52be1596b30f60b0b1c37ff/layer.tar -rw-r--r-- 0/0 90 2015-09-03 22:22 repositories ``` With this change, the layer's directory and artifact will have times matching the image layer's created time. The "repositories" file is set to epoch. ```bash vbatts@valse ~ (master) $ docker save busybox | tar tv drwxr-xr-x 0/0 0 2015-04-17 18:01 6ce2e90b0bc7224de3db1f0d646fe8e2c4dd37f1793928287f6074bc451a57ea/ -rw-r--r-- 0/0 3 2015-04-17 18:01 6ce2e90b0bc7224de3db1f0d646fe8e2c4dd37f1793928287f6074bc451a57ea/VERSION -rw-r--r-- 0/0 1405 2015-04-17 18:01 6ce2e90b0bc7224de3db1f0d646fe8e2c4dd37f1793928287f6074bc451a57ea/json -rw-r--r-- 0/0 2643968 2015-04-17 18:01 6ce2e90b0bc7224de3db1f0d646fe8e2c4dd37f1793928287f6074bc451a57ea/layer.tar drwxr-xr-x 0/0 0 2015-04-17 18:01 8c2e06607696bd4afb3d03b687e361cc43cf8ec1a4a725bc96e39f05ba97dd55/ -rw-r--r-- 0/0 3 2015-04-17 18:01 8c2e06607696bd4afb3d03b687e361cc43cf8ec1a4a725bc96e39f05ba97dd55/VERSION -rw-r--r-- 0/0 1346 2015-04-17 18:01 8c2e06607696bd4afb3d03b687e361cc43cf8ec1a4a725bc96e39f05ba97dd55/json -rw-r--r-- 0/0 1024 2015-04-17 18:01 8c2e06607696bd4afb3d03b687e361cc43cf8ec1a4a725bc96e39f05ba97dd55/layer.tar drwxr-xr-x 0/0 0 2015-04-17 18:01 cf2616975b4a3cba083ca99bc3f0bf25f5f528c3c52be1596b30f60b0b1c37ff/ -rw-r--r-- 0/0 3 2015-04-17 18:01 cf2616975b4a3cba083ca99bc3f0bf25f5f528c3c52be1596b30f60b0b1c37ff/VERSION -rw-r--r-- 0/0 1181 2015-04-17 18:01 cf2616975b4a3cba083ca99bc3f0bf25f5f528c3c52be1596b30f60b0b1c37ff/json -rw-r--r-- 0/0 1024 2015-04-17 18:01 cf2616975b4a3cba083ca99bc3f0bf25f5f528c3c52be1596b30f60b0b1c37ff/layer.tar -rw-r--r-- 0/0 90 1969-12-31 19:00 repositories ``` Side effect of this is that the tar stream from `docker save` is now more deterministic. ```bash vbatts@valse ~ (master) $ docker save busybox | sha1sum baf03e30ef79ca4d9c5e512d3a1b873880f404ca - vbatts@valse ~ (master) $ docker save busybox | sha1sum baf03e30ef79ca4d9c5e512d3a1b873880f404ca - vbatts@valse ~ (master) $ docker save busybox | sha1sum baf03e30ef79ca4d9c5e512d3a1b873880f404ca - vbatts@valse ~ (master) $ docker save busybox | sha1sum baf03e30ef79ca4d9c5e512d3a1b873880f404ca - ``` Signed-off-by: Vincent Batts <vbatts@redhat.com>
|
Wouldn't it make more sense to have |
|
Maybe. There can be a number of images and tagged layers. Then it would be a sort and still variadic. Regardless of the arguments passed to |
|
LGTM |
|
@vbatts thanks for clarifying; makes sense 👍 |
|
I literally can't even lxc. No idea what these failures are, but w/e. |
|
How about an integration test? |
|
ooh |
|
@cpuguy83 done. PTAL |
There was a problem hiding this comment.
A nit, but :
err := json.Unmarshal([]byte(out), &data)
c.Assert(err, checker.IsNil, "failed to marshal from %q: err %v", repoName, err)|
integration-cli/docker_cli_save_load_test.go:110: wrong number of args for format in Fatalf call: 1 needed but 2 args |
|
@cpuguy83 huh? + go test -check.f TestSaveCheckTimes -test.timeout=60m -check.v github.com/docker/docker/integration-cli
INFO: Testing against a local daemon
PASS: docker_cli_save_load_test.go:99: DockerSuite.TestSaveCheckTimes 0.062s
OK: 1 passed
PASS |
0811924 to
3ac60dd
Compare
|
@vdemeester updated to use assertion, though that loses the context message if it fails :-\ |
|
@vbatts why not using the |
The `docker save`ed output ought to have matching timestamp to the layer creation. Signed-off-by: Vincent Batts <vbatts@redhat.com>
3ac60dd to
e4478ca
Compare
|
added commentf On Thu, Oct 1, 2015 at 2:28 PM, Vincent Demeester notifications@github.com
|
|
LGTM |
|
Same old windows failure |
graph: exported images times matching creation
|
I'm attempting to do some local caching of separate layers of the build process for a particularly grueling npm install pass, and I'm hitting on an issue that seems related to this. Using this minimal image: And running the following command on OSX repeatably, it produces different sha1 checksums. I'm on OSX though, so I'm using the > docker build -t help .
> docker save $(docker history -q help) | openssl sha1
35da520b07a54d5f771d9bdae6e8d646d99109e8
> docker save $(docker history -q help) | openssl sha1
530b5ce927101400c2c4c7ceb908e87108a0736aThe following command still produces consistent sha1: Does anyone know what's the reason for the differences in the checksum that I'm seeing? |


the image export, that is used in
docker saveprevious has just hadthe layers times (atimes, mtimes) be when the save was done.
With this change, the layer's directory and artifact will have times
matching the image layer's created time. The "repositories" file is set
to epoch.
Side effect of this is that the tar stream from
docker saveis nowmore deterministic.
This idea came about from thinking about #8819 (comment)
Signed-off-by: Vincent Batts vbatts@redhat.com