Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker image created date is displaying incorrectly

Tags:

docker

I am relatively new to Docker and have noticed a strange issue with the images I am creating.

My very simple Dockerfile looks like this:

FROM php:5.4-apache
COPY --chown=www-data:www-data src /var/www/html
COPY php/php.ini /usr/local/etc/php
RUN docker-php-ext-install pdo pdo_mysql

After I build the image and use the 'docker image ls' command I get the following output.

REPOSITORY              TAG       IMAGE ID       CREATED        SIZE
xxxxx/dcalc             latest    ea718faxxxxx   6 years ago    477MB

I don't understand why the CREATED date is showing 6 years ago. I get that the base image (referred to in the FROM command) is that old, but shouldn't my image which has a COPY command in it create a new image with a current created date?

If this is expected behaviour can somebody explain why it is correct?

EDIT: I am on MacOS using Docker Desktop, but its the same behaviour on Linux (Docker version 20.10.17, build 100c701).

Thanks.

like image 934
ankGT Avatar asked Nov 02 '25 10:11

ankGT


1 Answers

I just set up Docker for the first time and had the same question, that's how I came across your thread. I realized that in my case -- and this might not apply to you -- the images in question were generated by external sources, so the created dates are presumably based on their original creation date or a later modification date by the source, not the date they're created on my computer. One was a welcome-to-docker image generated by Docker, and the other was a Vikunja image. The date for any container that I create myself is generating correctly.

like image 136
zargosh Avatar answered Nov 05 '25 00:11

zargosh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!