title: Docker build ubuntu:xenial issue
body: <p>I try to build a docker image with docker-py in Jenkins. </p>
  
  <h1>The scripts looks like this:</h1>
  
  <pre><code># Let's build the toolchain-base-image
  from io import BytesIO
  from docker import Client
  from pprint import pprint
  import sys
  
  cli = Client(base_url="tcp://127.0.0.1:4243")
  #cli = Client(base_url='unix://var/run/docker.sock')
  GCC_VERSION_TAG="4_9"
  with open("/path/to/docker-" + GCC_VERSION_TAG + "-gcc-base-image-dockerfile", mode="r") as dockerfile:
    f = BytesIO(dockerfile.read().encode('utf-8'))
    try:
        response = [pprint(line["stream"]) for line in cli.build(fileobj=f, nocache=False, rm=True, tag='gcc49/toolchain-base_'+GCC_VERSION_TAG, decode=True, pull=True)]
    except:
        raise IOError("Invalid Dockerfile!")
    if response != "None":
        pprint(response[0])
  
  print "Create container"
  container = cli.create_container(image='gcc49/toolchain-base_' + GCC_VERSION_TAG + ':latest',stdin_open=True, tty=True, volumes=['/ssd', '/opt', '/nfs/'], host_config=cli.create_host_config(binds=['/ssd:/ssd:rw','/opt/:/opt:ro','/nfs:/nfs:rw']))
  print "Start container"
  cli.start(container=container.get('Id'))
  log_stream_list = []
  [log_stream_list.append(l) for l in cli.logs(container, stream=True)]
  
  print "".join(log_stream_list)
  </code></pre>
  
  <h1>My dockerfile looks like this:</h1>
  
  <pre><code>FROM ubuntu:16.04
  MAINTAINER Gino
  ENV CMAKE_TOOLCHAIN_FILE /path/to/toolchainfile.toolchain
  ENV SOURCE_DIR /path/to/src_root
  RUN apt-get update 
  RUN apt-get install -y python-cheetah build-essential gcc-4.9 cmake
  RUN groupadd group
  RUN useradd -G group -m -s /bin/bash user 
  RUN echo "user:user" | chpasswd
  ENV HOME /home/user
  ENV SHELL /bin/bash
  ENV JAVA_HOME /opt/jdk1.8.0_65/
  RUN mkdir -p /home/user/docker-build
  WORKDIR /home/user/docker-build
  # Set permissions
  RUN chown -R user:group /home/*
  USER user
  # Start build on run
  ENTRYPOINT cmake -DBUILD_JAVA=0 -DCMAKE_BUILD_TYPE=DeveloperRelease -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DPROJECT_CONFIGURATION="project@${SOURCE_DIR}/dir" ${SOURCE_DIR} &amp;&amp; make -j4
  </code></pre>
  
  <h1>My issue:</h1>
  
  <pre><code>15:37:27 [docker-test_job] $ python /tmp/hudson5834793409651253293.py
  15:37:29 u'Step 1 : FROM ubuntu:16.04\n'
  15:37:29 Traceback (most recent call last):
  15:37:29   File "/tmp/hudson5834793409651253293.py", line 15, in &lt;module&gt;
  15:37:29     raise IOError("Invalid Dockerfile!")
  15:37:29 IOError: Invalid Dockerfile!
  15:37:29 Build step 'Execute Python script' marked build as failure
  15:37:29 Stopping all containers
  15:37:29 Finished: FAILURE
  </code></pre>
  
  <p>When I try it with ubuntu:14.04 it works pretty fine. Got anyone an idea?
  Thanks for helping!</p>
  
  <p>Update: Some additional information: Docker 1.5 + Ubuntu 12.04 LTS. 
  When I run on console</p>
  
  <pre><code>docker build -t name/tag -f dockerfilename .
  </code></pre>
  
  <p>it works too and the docker builds the image as expected.</p>