Docker 图像时间戳问题

Docker Image Timestamp Issue

我创建了一张全新的图片,但它显示 50 years ago timestamp,请查看附件中的代码片段。知道为什么吗?

我在 Dockerfile 中使用了以下步骤

FROM openjdk:11

VOLUME /tmp

COPY build/libs /app

ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app/test-service.jar"]

我的 docker 版本是

Docker version 19.03.5, build 633a0ea

Gradle 6.0.1 构建工具,以及 Google Jib 插件来创建图像

plugins {
    id 'com.google.cloud.tools.jib' version '1.8.0'
}

jib {
    from {
        image = 'openjdk:11'
    }
    to {
        image = 'test-service'
    }
    container {
        jvmFlags = ['-Xms512m', '-Xdebug']
        mainClass = 'com.sample.Application'
    }
    allowInsecureRegistries=true
}

来自 Google Jib。为了再现性,他们没有设置日期,或者他们明确地将日期设置为零值,即 1970 年的纪元。

有一个常见问题解答条目:https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#why-is-my-image-created-48-years-ago

For reproducibility purposes, Jib sets the creation time of the container images to the Unix epoch (00:00:00, January 1st, 1970 in UTC). If you would like to use a different timestamp, set the jib.container.creationTime / <container><creationTime> parameter to an ISO 8601 date-time. You may also use the value USE_CURRENT_TIMESTAMP to set the creation time to the actual build time, but this sacrifices reproducibility since the timestamp will change with every build.

Setting creationTime parameter

Maven:

<configuration>
  <container>
    <creationTime>2019-07-15T10:15:30+09:00</creationTime>
  </container>
</configuration>

Gradle:

jib.container.creationTime = '2019-07-15T10:15:30+09:00'