Skip to content

docker image ls --format '{{ .Digest }}' unexpectedly returns none #435

@cdman

Description

@cdman

Description

Output of docker image ls --format '{{ .Digest }}'

<none>
<none>
<none>
<none>
<none>

Output of docker image ls --digests

REPOSITORY                    TAG                 DIGEST                                                                    IMAGE ID            CREATED             SIZE
ubuntu                        17.04               sha256:cfa1858e82f340ab6fdd6d52a49b5c792311cdfd74c8d50420d99753450707ae   8694892af3c5        7 weeks ago         92.7 MB
node                          latest              sha256:efeb830cb88499eafc9bc37e6d2f56dd9933eb7b14d6aede2a75e7b4bd12642d   fe34ff26547c        4 months ago        666 MB
php                           latest              sha256:6a019046ac33cf6b1f43231d50802e751a104419caff80fd5423526f43d17a66   7ea0657799b7        4 months ago        365 MB
ubuntu                        16.10               sha256:e2837e43dba2aeb25282045d6e8c43cc21da443b2802ff87be9bdecc619e9b26   30b23364a716        5 months ago        104 MB
hello-world                   latest              sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7   48b5124b2768        6 months ago        1.84 kB

Some further investigations I did:

I don't know golang, but here are some things I tried:

  • It seems to me that (based on the source code) doing docker image ls --digests should be equivalent to docker image ls --format 'table {{.Repository}}\t{{.Tag}}\t{{.Digest}}\t{{.ID}}\t{{.CreatedSince}}\t{{.Size}}', however that still prints "".
  • I tried to inspect the "image context" with docker image ls --format '{{ . | printf "%+v" }}' which gave an output like:
&{HeaderContext:{header:<nil>} trunc:true i:{Containers:-1 Created:1498000995 ID:sha256:8694892af3c55e1661711d60d5fc7dddafc058baa60b8c7cfb61df141a5400cd Labels:map[] ParentID: RepoDigests:[ubuntu@sha256:cfa1858e82f340ab6fdd6d52a49b5c792311cdfd74c8d50420d99753450707ae] RepoTags:[ubuntu:17.04] SharedSize:-1 Size:92679975 VirtualSize:92679975} repo:ubuntu tag:17.04 digest:<none>}
&{HeaderContext:{header:<nil>} trunc:true i:{Containers:-1 Created:1490217480 ID:sha256:fe34ff26547c94bcd77cd1a243a92e15de68125be2fe162dff3ae75d0f879a1a Labels:map[] ParentID: RepoDigests:[node@sha256:efeb830cb88499eafc9bc37e6d2f56dd9933eb7b14d6aede2a75e7b4bd12642d] RepoTags:[node:latest] SharedSize:-1 Size:665561602 VirtualSize:665561602} repo:node tag:latest digest:<none>}
...

So digest indeed seems to be none and I should do something like {{ .ParentID }} or {{ .ParentId }} or perhaps {{ .i.ParentId }}, however none of those variantions seem to work.

Output of docker version:

Client:
 Version:      17.06.0-ce
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   02c1d87
 Built:        Fri Jun 23 21:18:10 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.06.0-ce
 API version:  1.30 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   02c1d87
 Built:        Fri Jun 23 21:17:03 2017
 OS/Arch:      linux/amd64
 Experimental: false

Output of docker info:

Containers: 3
 Running: 1
 Paused: 0
 Stopped: 2
Images: 22
Server Version: 17.06.0-ce
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 56
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: cfb82a876ecc11b5ca0977d1733adbe58599088a
runc version: 2d41c047c83e09a6d61d464906feb2a2f3c52aa4
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.10.0-32-generic
Operating System: Ubuntu 17.04
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 7.705GiB
Name: gpanther-macpro
ID: YO6X:HUXZ:R332:IVD3:YERR:6EJP:SHQ6:RGK3:FJB5:7EPZ:VPDR:ZRNS
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: gpanther
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

Additional environment details (AWS, VirtualBox, physical, etc.):

This is on Ubuntu 17.04, docker installed from official repository (deb [arch=amd64] https://download.docker.com/linux/ubuntu zesty stable)

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