See https://github.com/docker/compose/issues/1329#issuecomment-133909344 for the test case. I believe the bug is here: https://github.com/docker/docker-py/blob/1.3.1/docker/client.py#L97 It should use `dockerfile` as the name instead of `Dockerfile` if it's not None.