docker_image: added support for docker_py >= 0.3.0, Docker API >= 1.8. Replace #6178

Fixes problems with new versions of Docker (Docker API, docker-py).