Red Hat Bugzilla – Bug 1092773
Image and container JSON keys have no consistency
Last modified: 2015-03-18 05:09:53 EDT
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:
I wonder if it is too late to fix these? Since docker 1.0 has shipped. is this part of the protocol now.
Actually looking at docker 1.0 I think this might be fixed.
Confirmed fixed in docker-1.0.0-10.el7.x86_64 All keys are in CamelCase.
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