Skip to content

[BUG] docker compose images shows incorrect CREATED date ("292 years ago") because LastTagTime is unset #13166

@EramusBlack1

Description

@EramusBlack1

Description

When running docker compose images, the CREATED column displays absurd values such as “292 years ago” instead of the actual image build time.

This happens because Compose is using the LastTagTime field from image metadata, which defaults to 0001-01-01T00:00:00Z if the image was pulled or built without a local tag event. The underlying image config has a valid .Created field, but this are ignored.

Expected behaviour:

docker compose images should display the actual build/creation time of the image, based on the image’s Created field

Actual behaviour:

docker compose images shows 292 years ago because it renders Metadata.LastTagTime, which defaults to 0001-01-01T00:00:00Z unless explicitly set.

Cause

In cmd/compose/images.go, compose sets the Created column to i.LastTagTime:

imageList = append(imageList, img{
ContainerName: ctr,
ID: i.ID,
Repository: i.Repository,
Tag: i.Tag,
Platform: platforms.Format(i.Platform),
Size: i.Size,
LastTagTime: i.LastTagTime,
})

This was introduced in commit ea1c26d.

Steps To Reproduce

[testuser@vbox ]$ mkdir dockertest && cd dockertest
[testuser@vbox dockertest]$ vi docker-compose.yaml

Minimal yaml for alpine:3.18

services:
  alpine:
    image: alpine:3.18
    command: sleep 3600
[testuser@vbox dockertest]$ 
[testuser@vbox dockertest]$ docker compose up -d
[+] Running 2/2
 ✔ alpine Pulled                                                                                                                                                                         3.0s 
   ✔ 44cf07d57ee4 Pull complete                                                                                                                                                          0.9s 
[+] Running 2/2
 ✔ Network dockertest_default     Created                                                                                                                                                0.4s 
 ✔ Container dockertest-alpine-1  Started                                                                                                                                                0.6s 
[testuser@vbox dockertest]$ docker compose images
CONTAINER             REPOSITORY          TAG                 PLATFORM            IMAGE ID            SIZE                CREATED
dockertest-alpine-1   alpine              3.18                linux/amd64         802c91d52981        7.36MB              292 years ago

[testuser@vbox dockertest]$ docker inspect alpine:3.18 | grep -i created
        "Created": "2025-02-14T03:03:06Z",

[testuser@vbox dockertest]$ docker inspect --format '{{json .Metadata}}' alpine:3.18
{"LastTagTime":"0001-01-01T00:00:00Z"}

Compose Version

Docker Compose version v2.39.1

Client: Docker Engine - Community
 Version:           28.3.3
 API version:       1.51
 Go version:        go1.24.5
 Git commit:        980b856
 Built:             Fri Jul 25 11:37:02 2025
 OS/Arch:           linux/amd64
 Context:           default

Docker Environment

Client: Docker Engine - Community
 Version:    28.3.3
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.26.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.39.1
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 19
  Running: 17
  Paused: 0
  Stopped: 2
 Images: 19
 Server Version: 28.3.3
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 05044ec0a9a75232cad458027ca83437aae3f4da
 runc version: v1.2.5-0-g59923ef
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.14.0-570.32.1.el9_6.x86_64
 Operating System: Rocky Linux 9.6 (Blue Onyx)
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 15.36GiB
 Name: vbox
 ID: cc1c9b11-effe-4d5e-a634-2657c29d70e1
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: ptcustomers
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions