Mismatch in Docker Field Names for timeNano and Other Fields Using --format '{{json.timeNano}}'
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 2.2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
Description
- This is a bug report
- This is a feature request
- I searched existing issues before opening this one
Expected behavior
The JSON output the field names should be able to be used directly vs changing the the field name to start with uppercase
docker system events --since 1h --until 1m --format '{{json .}}'
This should work as it matches the JSON field name.
docker system events --since 1h --until 1m --format '{{json .timeNano}}'
Actual behavior
// This does not work and generates an error -- timeNano
docker system events --since 1h --until 1m --format '{{json .timeNano}}'
// This works -- TimeNano
docker system events --since 1h --until 1m --format '{{json .TimeNano}}'
Steps to reproduce the behavior
Docker version 20.10.8, build 3967b7d
Ubuntu: 18.04.5 LTS
Running this command outputs JSON as expected.
docker system events --since 1h --until 1m --format '{{json .}}'
Inside of the JSON data will find the field timeNano is output in JSON like below:
"timeNano":1631794341804708170
However, running the command below results in an error. If "TimeNano" is used instead it works to show the data.
docker system events --since 1h --until 1m --format '{{json .timeNano}}'
Results in an error below:
Error parsing format: template: :1:7: executing "" at <.timeNano>: can't evaluate field timeNano in type *eventsMessage
There is a mismatch in additional field names for roughly 30% of the field names have issues similar to above due to the field name not matching due to case sensitivity and inconsistency.
Output of docker version:
Docker version 20.10.8, build 3967b7d
Output of docker info:
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.6.1-docker)
scan: Docker Scan (Docker Inc., v0.8.0)
Server:
Containers: 14
Running: 9
Paused: 0
Stopped: 5
Images: 274
Server Version: 20.10.8
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: e25210fe30a0a703442421b0f60afac609f950a3
runc version: v1.0.1-0-g4144b63
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 5.4.0-84-generic
Operating System: Ubuntu 18.04.5 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.56GiB
Name: eia-NUC8i7HVK
ID: A2MN:75RO:IDNC:VXXS:QIXL:S6KB:C5E3:CSSJ:S2NV:ZOR4:DOBS:DFFT
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
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.)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Docker CLI system events commands with --format '{{json .}}' and the .timeNano and .TimeNano variants. Trace the system events format handling to determine why JSON field names differ from template field names; done means the documented lowercase field names work consistently, including timeNano.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100