'``DockerClient.add`` can start containers based on an image from a
private registry.
A private registry is started in a container according to the
instructions at:
* https://docs.docker.com/registry/deploying/
An image is pushed to that private registry and then a Flocker
application is started that uses that private repository image name.
Docker can pull from a private registry without any TLS configuration
as long as it\'s running on the local host.'

@require_docker_version('1.6.0', 'This    test    uses    the    registry:2    image    which    requires    Docker-1.6.0    or    newer.    See    https://docs.docker.com/registry/deploying/    for    details.')
def test_private_registry_image(self):

    registry_listening = self.run_registry()
    def tag_and_push_image(registry):
        client = dockerpy_client()
        image_name = ANY_IMAGE
        client.pull(image_name)
        registry_image = self.push_to_registry(image_name, registry)
        self.addCleanup(client.remove_image, image=registry_image.full_name)
        return registry_image
    pushing_image = registry_listening.addCallback(tag_and_push_image)
    def start_registry_image(registry_image):
        return self.start_container(unit_name=random_name(self), image_name=registry_image.full_name)
    starting_registry_image = pushing_image.addCallback(start_registry_image)
    return starting_registry_image
