(self, targets: Iterable[str])
return container
Creates and returns the Docker container
Creates and returns the Docker container
Creates and returns the Docker container
def _create_container(self, targets: Iterable[str]) -> "Container":
        """
        Creates and returns the Docker container
        """

        client = get_docker_client()

        our_containers = client.containers.list(
            filters={"name": self.container_name, "status": "running"}
        )
        if our_containers:
            logging.info(f"using existing {self.tool_id()} container")
            return our_containers[0]

        vols = {} if self.use_remote_docker else self.local_volume_mapping
        full_command = self.assemble_full_command(targets)

        logging.info(f"starting new {self.tool_id()} container")

        container: "Container" = client.containers.create(
            self.docker_image,
            command=full_command,
            auto_remove=True,
            name=self.container_name,
            volumes=vols,
            detach=True,
            working_dir=self.remote_code_path,
        )
        logging.info(f"started container: {container!r}")

        return container
def _create_container ( self , targets : Iterable [ str ] ) -> "Container" : client = get_docker_client ( ) our_containers = client . containers . list ( filters = { "name" : self . container_name , "status" : "running" } ) if our_containers : logging . info ( f"using existing {self.tool_id()} container" ) return our_containers [ 0 ] vols = { } if self . use_remote_docker else self . local_volume_mapping full_command = self . assemble_full_command ( targets ) logging . info ( f"starting new {self.tool_id()} container" ) container : "Container" = client . containers . create ( self . docker_image , command = full_command , auto_remove = True , name = self . container_name , volumes = vols , detach = True , working_dir = self . remote_code_path , ) logging . info ( f"started container: {container!r}" ) return container