Pull remote Docker image if it isn't available locally

If demanded image wasn't available locally on the process of building image with docker run, docker returned error and stopped.
Reused @mfojtik code and refactored it.