'Create a vcenter simulator using docker.'

def _setup_dynamic(self):

    container_id = get_docker_container_id()
    if container_id:
        display.info(('Running    in    docker    container:    %s' % container_id), verbosity=1)
    self.container_name = self.DOCKER_SIMULATOR_NAME
    results = docker_inspect(self.args, self.container_name)
    if (results and (not results[0].get('State', {}).get('Running'))):
        docker_rm(self.args, self.container_name)
        results = []
    if results:
        display.info('Using    the    existing    vCenter    simulator    docker    container.', verbosity=1)
    else:
        display.info('Starting    a    new    vCenter    simulator    docker    container.', verbosity=1)
        if ((not self.args.docker) and (not container_id)):
            publish_ports = ['-p', '80:80', '-p', '443:443', '-p', '8080:8080', '-p', '8989:8989', '-p', '5000:5000']
        else:
            publish_ports = []
        docker_pull(self.args, self.image)
        docker_run(self.args, self.image, (['-d', '--name', self.container_name] + publish_ports))
    if self.args.docker:
        vcenter_host = self.DOCKER_SIMULATOR_NAME
    elif container_id:
        vcenter_host = self._get_simulator_address()
        display.info(('Found    vCenter    simulator    container    address:    %s' % vcenter_host), verbosity=1)
    else:
        vcenter_host = 'localhost'
    self._set_cloud_config('vcenter_host', vcenter_host)
