'Reconstruct the original application state from the container state
that resulted from it.
:param list containers: The Docker containers that exist here.
:param path_to_manifestations: See ``_attached_volume_for_container``.
:return: A ``list`` of ``Application`` instances inferred from
``containers`` and ``path_to_manifestations``.'

def _applications_from_containers(self, containers, path_to_manifestations):

    applications = []
    for container in containers:
        image = DockerImage.from_string(container.container_image)
        volume = self._attached_volume_for_container(container, path_to_manifestations)
        ports = self._ports_for_container(container)
        (links, environment) = self._environment_for_container(container)
        applications.append(Application(name=unicode(container.name), image=image, ports=frozenset(ports), volume=volume, environment=(environment if environment else None), links=frozenset(links), memory_limit=container.mem_limit, cpu_shares=container.cpu_shares, restart_policy=container.restart_policy, running=(container.activation_state == u'active'), command_line=container.command_line))
    return applications
