GoogleContainerTools/jib · error · BadContainerConfigurationFormatException
Invalid image creation time: + containerConfigurationTemplat
Error message
Invalid image creation time: + containerConfigurationTemplate.getCreated()
What it means
The container configuration's 'created' timestamp must be an ISO-8601 offset date-time. Jib parses it with DateTimeFormatter.ISO_OFFSET_DATE_TIME (working around the lack of Instant.parse for offsets on Java < 12) and throws BadContainerConfigurationFormatException when parsing fails.
Source
Thrown at jib-core/src/main/java/com/google/cloud/tools/jib/image/json/JsonToImageTranslator.java:160
private static void configureBuilderWithContainerConfiguration(
Image.Builder imageBuilder, ContainerConfigurationTemplate containerConfigurationTemplate)
throws BadContainerConfigurationFormatException {
containerConfigurationTemplate.getHistory().forEach(imageBuilder::addHistory);
if (containerConfigurationTemplate.getCreated() != null) {
try {
imageBuilder.setCreated(Instant.parse(containerConfigurationTemplate.getCreated()));
} catch (DateTimeParseException ex) {
try {
// TODO: remove when using Java >= 12.
// See https://github.com/GoogleContainerTools/jib/issues/2428
imageBuilder.setCreated(
DateTimeFormatter.ISO_OFFSET_DATE_TIME.parse(
containerConfigurationTemplate.getCreated(), Instant::from));
} catch (DateTimeParseException ignored) {
throw new BadContainerConfigurationFormatException(
"Invalid image creation time: " + containerConfigurationTemplate.getCreated(), ex);
}
}
}
if (containerConfigurationTemplate.getArchitecture() != null) {
imageBuilder.setArchitecture(containerConfigurationTemplate.getArchitecture());
}
if (containerConfigurationTemplate.getOs() != null) {
imageBuilder.setOs(containerConfigurationTemplate.getOs());
}
imageBuilder.setEntrypoint(containerConfigurationTemplate.getContainerEntrypoint());
imageBuilder.setProgramArguments(containerConfigurationTemplate.getContainerCmd());
List<String> baseHealthCheckCommand = containerConfigurationTemplate.getContainerHealthTest();
if (baseHealthCheckCommand != null) {
DockerHealthCheck.Builder builder = DockerHealthCheck.fromCommand(baseHealthCheckCommand);View on GitHub (pinned to fb949e2676)
Solutions
- Fix the container configuration's 'created' field to ISO-8601 with offset, e.g. '2023-01-15T10:30:00+00:00' or '...Z'
- Pre-validate the timestamp with DateTimeFormatter.ISO_OFFSET_DATE_TIME parse in a try-catch before calling toImage
- Catch BadContainerConfigurationFormatException and fall back to a default created time or omit the field
Example fix
// before "created": "2023/01/15 10:30:00" // after "created": "2023-01-15T10:30:00Z"
Defensive patterns
Strategy: validation
Validate before calling
try {
DateTimeFormatter.ISO_OFFSET_DATE_TIME.parse(created, Instant::from);
} catch (DateTimeParseException e) {
throw new IllegalArgumentException("created must be ISO-8601 offset date-time: " + created);
} Try / catch
try { JsonToImageTranslator.toImage(manifest, config); } catch (BadContainerConfigurationFormatException e) { /* normalize 'created' to ISO-8601 and retry */ } Prevention
- Write 'created' as ISO-8601 with offset (e.g. ...Z or +00:00)
- Validate config timestamps before feeding configs from third-party tooling to Jib
- Catch BadContainerConfigurationFormatException around all toImage calls
When it happens
Trigger: Calling JsonToImageTranslator.toImage with a container configuration whose 'created' field is absent of timezone offset, empty, or in a non-ISO format (e.g. epoch millis, 'yyyy-MM-dd HH:mm:ss').
Common situations: Container configs produced by non-Docker tooling writing local-format timestamps; hand-edited config JSON; registries serving configs with nonconforming created fields; configs from older builders using different date formats.
Related errors
- Diff ID not available for reference layer without diff ID
- Mismatch between image manifest and container configuration
- Invalid environment variable definition: + environmentVariab
- Path does not start with forward slash (/): ${unixPath}
- Cannot create AbsoluteUnixPath from non-absolute Path: ${pat
AI-assisted analysis of GoogleContainerTools/jib@fb949e2676 (2026-09-06).
Data as JSON: /api/errors/b9c1a86accf14e16.
Report an issue: GitHub.