I run docker images
and get something like this:
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
docker.io/postgres latest a7d662bede59 2 weeks ago 265.3 MB
docker.io/ubuntu latest 91e54dfb1179 2 weeks ago 188.3 MB
Look at CREATED column. I want to know what image created earlier with hours, minutes, seconds. Similar with containers, for command docker ps -a
. How to view exact dates?
In addition to Dag's answer, you can permanently change the format of the output from
docker images
by adding your custom format to your ~/.docker/config.json file:Use
docker inspect
:From: Exact times in "docker ps" and "docker images"
You can use the
--format
parameter to outputCreatedAt
instead ofCreatedSince
:See the command line reference for more info.
I think the best way would be to run
docker inspect IMAGE_OR_CONTAINER
, then pipe the output to grep to filter the results to what you really want.If you only want to know when it started, run
docker inspect IMAGE_OR_CONTAINER | grep -i created
... which results in the following output:
That's pretty clean.
... you could do the same for "started":
docker inspect IMAGE_OR_CONTAINER | grep -i started
... which results in the following output: