Better error checking when creating dockerfile image