¿Cómo obtener la fecha exacta de las imágenes de docker?


Corro docker images y obtengo algo como esto:

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

Mira la columna CREADA. Quiero saber qué imagen se creó antes con horas, minutos, segundos. Similar con los contenedores, para command docker ps -a. Cómo ver las fechas exactas?

 26
Author: Alex T, 2015-09-22

3 answers

Use docker inspect:

docker inspect -f '{{ .Created }}' IMAGE_OR_CONTAINER

De: Tiempos exactos en "docker ps "y"docker images"

 37
Author: wbrugato,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-23 11:47:05

Puede usar el parámetro --format para generar CreatedAt en lugar de CreatedSince:

docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.ID}}\t{{.CreatedAt}}\t{{.Size}}"

Consulte la referencia de la línea de comandos para obtener más información.

 4
Author: Dag Høidahl,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-04-13 07:28:54

Creo que la mejor manera sería ejecutar docker inspect IMAGE_OR_CONTAINER, luego canalizar la salida a grep para filtrar los resultados a lo que realmente desea.

Si solo quieres saber cuándo se inició, ejecuta

docker inspect IMAGE_OR_CONTAINER | grep -i created

... que da como resultado el siguiente resultado:

"Created": "2015-09-18T01:46:51.471641483Z",

Eso está bastante limpio.

... puedes hacer lo mismo para"started":

docker inspect IMAGE_OR_CONTAINER | grep -i started

... que da como resultado el siguiente resultado:

"StartedAt": "2015-09-18T01:46:51.79789586Z"
 2
Author: Caleb,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-09-21 22:21:24