Move the docker-specific logic up to the ImageManager to allow code sharing among different implementations.