def _build_installer_in_docker(self, cluster, online_installer=None,
                                   unique=False):
        if online_installer is None:
            paTestOnlineInstaller = os.environ.get('PA_TEST_ONLINE_INSTALLER')
            online_installer = paTestOnlineInstaller is not None

        container_name = 'installer'
        installer_container = DockerCluster(
            container_name, [], DEFAULT_LOCAL_MOUNT_POINT,
            DEFAULT_DOCKER_MOUNT_POINT)
        try:
            installer_container.create_image(
                BASE_TD_DOCKERFILE_DIR,
                BASE_TD_IMAGE_NAME,
                BASE_IMAGE_NAME
            )
            installer_container.start_containers(
                BASE_TD_IMAGE_NAME
            )
        except DockerClusterException as e:
            installer_container.tear_down()
            self.testcase.fail(e.msg)

        try:
            shutil.copytree(
                prestoadmin.main_dir,
                os.path.join(
                    installer_container.get_local_mount_dir(container_name),
                    'presto-admin'),
                ignore=shutil.ignore_patterns('tmp', '.git', 'presto*.rpm')
            )

            # Pin pip to 7.1.2 because 8.0.0 removed support for distutils
            # installed projects, of which the system setuptools is one on our
            # Docker image. pip 8.0.1 or 8.0.2 replaced the error with a
            # deprecation warning, and also warns that Python 2.6 is
            # deprecated. While we still need to support Python 2.6, we'll pin
            # pip to a 7.x version, but we should revisit this once we no
            # longer need to support 2.6:
            # https://github.com/pypa/pip/issues/3384
            installer_container.run_script_on_host(
                'set -e\n'
                'pip install --upgrade pip==7.1.2\n'
                'pip install --upgrade wheel==0.23.0\n'
                'pip install --upgrade setuptools==20.1.1\n'
                'mv %s/presto-admin ~/\n'
                'cd ~/presto-admin\n'
                'make %s\n'
                'cp dist/prestoadmin-*.tar.bz2 %s'
                % (installer_container.mount_dir,
                   'dist' if online_installer else 'dist-offline',
                   installer_container.mount_dir),
                container_name)

            try:
                os.makedirs(cluster.get_dist_dir(unique))
            except __HOLE__, e:
                if e.errno != errno.EEXIST:
                    raise
            local_container_dist_dir = os.path.join(
                prestoadmin.main_dir,
                installer_container.get_local_mount_dir(container_name)
            )
            installer_file = fnmatch.filter(
                os.listdir(local_container_dist_dir),
                'prestoadmin-*.tar.bz2')[0]
            shutil.copy(
                os.path.join(local_container_dist_dir, installer_file),
                cluster.get_dist_dir(unique))
        finally:
            installer_container.tear_down()
dataset/ETHPy150Open prestodb/presto-admin/tests/product/prestoadmin_installer.py/PrestoadminInstaller._build_installer_in_docker