Skip to content

Client.build(…) broken in 0.3.2 using Python 3 #257

@adamleko

Description

@adamleko

A simple test case:

$ cat Dockerfile 
FROM base

RUN echo foo

CMD /bin/true
$ cat build.py 
#!/usr/bin/env python
import os

from docker import Client

client = Client(os.getenv('DOCKER_HOST'))
for line in client.build('.', tag='atag', rm=True):
    print(line)

Running it produces this exception:

$ python build.py 
{"stream":" ---\u003e b750fe79269d\n"}

Traceback (most recent call last):
  File "build.py", line 8, in <module>
    for line in client.build('.', tag='atag', rm=True):
  File "/Users/adam/PYTHON3/lib/python3.4/site-packages/docker/client.py", line 233, in _stream_helper
    size = int(size_line, 16)
ValueError: invalid literal for int() with base 16: '\n'```

The Dockerfile works just fine with docker build and, with some trivial modifications, in 0.3.1.

I'm using a virtualenv'ed Python 3.4.0 installed via brew:

$ python --version
Python 3.4.0
$ pip list
docker-py (0.3.2)
mock (1.0.1)
pip (1.5.6)
requests (2.2.1)
setuptools (3.6)
six (1.7.3)

Docker server is at v1.0.0. (The client is outdated but I'm not using it for this test.)

$ docker version
Client version: 0.11.1
Client API version: 1.11
Go version (client): go1.2.1
Git commit (client): fb99f99
Server version: 1.0.0
Server API version: 1.12
Git commit (server): 63fe64c
Go version (server): go1.2.1
Last stable version: 1.0.1, please update docker

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions