Using buildah
, I can find out the date my image was built at with this call:
buildah images --format '{{.CreatedAt}}' my_image
The --format
argument is a Go template, as described for a related command.
This returns:
Nov 13, 2018 08:04
As far as I can tell that is my current timezone it uses, but it's not localised, and it's missing timezone information. If I feed the output into Linux's date
like so:
date -d "`buildah images --format '{{.CreatedAt}}' my_container`" +%s
This gives me what I want, UNIX epoch seconds:
1542063840
However, since my '{{.CreatedAt}}'
is a Go template that I should be able to format, how can I directly print out epoch seconds (or RFC-3339
, etc) rather than relying on date
.
As you can guess, I am an utter Go newbie and the documentation provided nothing I could copy-paste
NOTE: Following the below answer, enhancement request posted to the buildah
issues db.