'Start a unit and wait until it reaches the `active` state or the
supplied `expected_state`.
:param unicode unit_name: See ``IDockerClient.add``.
:param unicode image_name: See ``IDockerClient.add``.
:param list ports: See ``IDockerClient.add``.
:param expected_states: A sequence of activation states to wait for.
:param environment: See ``IDockerClient.add``.
:param volumes: See ``IDockerClient.add``.
:param mem_limit: See ``IDockerClient.add``.
:param cpu_shares: See ``IDockerClient.add``.
:param restart_policy: See ``IDockerClient.add``.
:param command_line: See ``IDockerClient.add``.
:return: ``Deferred`` that fires with the ``DockerClient`` when
the unit reaches the expected state.'

def start_container(self, unit_name, image_name=u'openshift/busybox-http-app:latest', ports=None, expected_states=(u'active',), environment=None, volumes=(), mem_limit=None, cpu_shares=None, restart_policy=RestartNever(), command_line=None, retry_on_port_collision=False):

    client = self.make_client()
    if retry_on_port_collision:
        add = partial(add_with_port_collision_retry, client)
    else:
        add = client.add
    d = add(unit_name=unit_name, image_name=image_name, ports=ports, environment=environment, volumes=volumes, mem_limit=mem_limit, cpu_shares=cpu_shares, restart_policy=restart_policy, command_line=command_line)
    self.addCleanup(client.remove, unit_name)
    d.addCallback((lambda _: wait_for_unit_state(reactor, client, unit_name, expected_states)))
    d.addCallback((lambda _: client))
    return d
