par*_*ack 3 docker dockerfile docker-image
我创建了一个全新的图像,但它显示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"]
Run Code Online (Sandbox Code Playgroud)
我的 docker 版本是
Docker version 19.03.5, build 633a0ea
Run Code Online (Sandbox Code Playgroud)
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
}
Run Code Online (Sandbox Code Playgroud)
那是来自 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 valueUSE_CURRENT_TIMESTAMPto set the creation time to the actual build time, but this sacrifices reproducibility since the timestamp will change with every build.Setting
creationTimeparameterMaven:
Run Code Online (Sandbox Code Playgroud)<configuration> <container> <creationTime>2019-07-15T10:15:30+09:00</creationTime> </container> </configuration>Gradle:
Run Code Online (Sandbox Code Playgroud)jib.container.creationTime = '2019-07-15T10:15:30+09:00'
| 归档时间: |
|
| 查看次数: |
2274 次 |
| 最近记录: |