Bug 1092773

Summary: Image and container JSON keys have no consistency
Product: Red Hat Enterprise Linux 7 Reporter: J.C. Molet <jmolet>
Component: dockerAssignee: Daniel Walsh <dwalsh>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.1CC: cevich, dwalsh, lsm5
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 03:18:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1138364    

Description J.C. Molet 2014-04-30 01:04:53 UTC
Description of problem:
The json config files for docker containers and images have no consistency whatsoever.  These are the files that are parsed/pretty-printed when you run docker inspect.  This causes automation and reporting around docker to have additional, needless, complexity.

Version-Release number of selected component (if applicable):
# docker version
Client version: 0.10.0
Client API version: 1.10
Go version (client): go1.2.1
Git commit (client): dc9c28f/0.10.0
Server version: 0.10.0
Server API version: 1.10
Git commit (server): dc9c28f/0.10.0
Go version (server): go1.2.1
Last stable version: 0.10.0


How reproducible:
always

Steps to Reproduce:
1. Run docker and pull down an image.  (ex: docker pull mattdm/fedora)
2. Use docker to create a simple container based off that image (ex. docker run mattdm/fedora /bin/bash -c "echo 'hello world'")
3. Run "docker inspect" against these images and containers.

Actual results:
Sometimes the JSON keys are CamelCase, sometimes_underscores, sometimes lowercase.  You have an image's "id" vs a container's "ID", in an image you'll have "Config" vs a container's "container_config".  In a image's JSON the outer keys will all be lowercase except for, randomly, Size - and they'll use underscores.  The inner keys for the same JSON are all in CamelCase.

# docker inspect 871613fadf3d
[{
    "id": "871613fadf3d8f5f4ab7737b5ae80d1ae7568c3d1117b8b378a7341a3f855cc2",
    "comment": "Imported from -",
    "created": "2013-12-17T12:42:21.01048812Z",
    "container_config": {
        "Hostname": "",
        "Domainname": "",
...
        "User": "",
        "NetworkDisabled": false,
        "OnBuild": null
    },
    "docker_version": "0.7.1",
    "architecture": "x86_64",
    "Size": 363959682

and on a container:
# docker inspect silly_einstein
[{
    "ID": "dc761aab614700a78082ccd6345957710c19ac480013104f71f1bd1bd4b977a9",
    "Created": "2014-04-01T17:30:09.992917458Z",
    "Path": "/bin/bash",
    "Args": [
        "-c",
        "rm -f stop; trap \"/usr/bin/date \u003e stop\" SIGUSR1; while ! [ -f stop ]; do :; done"
    ],
    "Config": {
        "Hostname": "dc761aab6147",
...
and so on
     

Expected results:
There should be a consistent key naming schema that brings the pretty printing of the docker inspect command some uniformity.

Additional info:

Comment 2 Daniel Walsh 2014-06-17 19:21:17 UTC
I wonder if it is too late to fix these?  Since docker 1.0 has shipped. is this part of the protocol now.

Comment 3 Daniel Walsh 2014-06-17 19:24:23 UTC
Actually looking at docker 1.0 I think this might be fixed.

Comment 5 Chris Evich 2014-07-18 14:44:27 UTC
Confirmed fixed in docker-1.0.0-10.el7.x86_64 All keys are in CamelCase.

Comment 7 errata-xmlrpc 2015-03-05 03:18:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-0623.html