Skip to content

_stream_helper returns invalid JSON or cannot decode #1059

@danpalmer

Description

@danpalmer

docker-py
1.8.0

python
3.5.0

docker
Version 1.11.1-beta10 (build: 6662)

OS
Mac OS X 10.11 Beta 15A279b


While using https://github.com/6si/shipwright, I found that invalid JSON was being returned by docker-py. According to the docs, the output of client.build should be an iterable of valid JSON objects encoded as strings (or the JSON objects decoded if decode=True is passed). e.g.

'{"stream":"Step 1 : FROM ubuntu:xenial\\n"}'

However, I have found while using the setup listed above, that it is returning strings like:

'{"stream":"Step 1 : FROM ubuntu:xenial\\n"}\r\n{"stream":"Step 2 : COPY foo\\n"}\r\n'

(Note the trailing CRLFs as well, differs from the documentation)

I suspect this issue is being triggered by the Docker side of things, it looks like the chunks in the chunked response used to align exactly with JSON objects, but now no longer do, although I'm not familiar enough with the Docker API to know if this is correct.

I also suspect I reached this issue because of the pre-release Docker installation, however I see that docker-py doesn't list compatible Docker versions, which makes it difficult to know if this is a bug or unimplemented functionality.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions