Bug 1243999

Summary: Content-Type field incorrect for image search response remote API
Product: [Fedora] Fedora Reporter: Roland Grunberg <rgrunber>
Component: dockerAssignee: smahajan <smahajan>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: rawhideCC: adimania, admiller, amurdaca, dwalsh, ichavero, jcajka, jchaloup, lsm5, mbenitez, miminar, vbatts
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-21 03:51:54 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:

Description Roland Grunberg 2015-07-16 20:16:17 UTC
The Content-Type field seems to be 'text/plain; charset=utf-8' for F22+ when doing a search for images (/images/search?term=rawhide) instead of the expected 'application/json'

As far as I can tell the remote API states that a proper image search response should have 'Content-Type: application/json' [1].

Steps to reproduce (after ensuring the /var/run/docker.sock unix socket is set up with proper permissions) :

$ socat TCP-LISTEN:8080,fork UNIX-CONNECT:/var/run/docker.sock &
..
$ curl -i -X GET "http://localhost:8080/images/search?term=rawhide"
HTTP/1.1 200 OK
Server: Docker/1.8.0-dev.fc23 (linux)
Date: Thu, 16 Jul 2015 19:50:57 GMT
Content-Length: 1007
Content-Type: text/plain; charset=utf-8

[{"index_name":"docker.io","registry_name":"docker.io","star_count":177,"is_official":true,"name":"fedora","is_trusted":false,"is_automated":false,"description":"Official Fedora 21 base image and semi-official Fedora 20 and rawhide images."},{"index_name":"docker.io","registry_name":"docker.io","star_count":1,"is_official":false,"name":"cyrusimapd/rawhide","is_trusted":false,"is_automated":false,"description":""},{"index_name":"docker.io","registry_name":"docker.io","star_count":1,"is_official":false,"name":"michilu/fedora-zero","is_trusted":true,"is_automated":true,"description":"120MB minimum rawhide not install anything"},{"index_name":"docker.io","registry_name":"docker.io","star_count":0,"is_official":false,"name":"alanfranz/drb-fedora-rawhide-x86-64","is_trusted":true,"is_automated":true,"description":""},{"index_name":"docker.io","registry_name":"docker.io","star_count":0,"is_official":false,"name":"alanfranz/fwd-fedora-rawhide","is_trusted":true,"is_automated":true,"description":""}]

The response is a json string, but the Content-Type says 'text/plain; charset=utf-8'. I also see the same behaviour on F22 (docker-1.7.0-6.git74e7a7a.fc22.x86_64) . On F21 (docker-io-1.6.0-4.git350a636.fc21.x86_64), the Content-Type is 'application/json', as expected so this seems to have changed somewhere in between the 2 releases.

[1] https://docs.docker.com/reference/api/docker_remote_api_v1.19/#search-images

Comment 1 Antonio Murdaca 2015-07-23 11:13:26 UTC
This has recently been fixed in docker master https://github.com/docker/docker/pull/14850

Comment 2 Daniel Walsh 2015-07-23 12:30:54 UTC
Thanks Antonio, That will be in the next docker-1.8 build hopefully today when we patch the firewalld issues.