docs: def provision(self,
                    bug: Bug,
                    uid: str = None,
                    tools: Optional[List[Tool]] = None,
                    volumes: Optional[Dict[str, str]] = None,
                    network_mode: str = 'bridge',
                    ports: Optional[Dict[int, int]] = None,
                    interactive: bool = False
                    ) -> Container:
          """
          Provisions and returns a container for a given bug.
  
          Parameters:
              bug: the bug that should be used to provision a container.
              uid: a unique identifier (UID) for the container. If no UID is
                  provided then one will be automatically generated.
  
          Returns:
              a description of the provisioned container.
          """
          if tools is None:
              tools = []
          if volumes is None:
              volumes = {}
          if ports is None:
              ports = {}
  
          if uid is None:
              uid = str(uuid.uuid4())
          logger.debug("provisioning container for bug %s: %s",
                       bug.name, uid)
  
          tool_containers = [self.__installation.tools.provision(t) for t in tools]
          self.__dockerc_tools[uid] = tool_containers
          tool_container_ids = [c.id for c in tool_containers]
  
          # prepare the environment for the container
          logger.debug("creating temporary environment file for container %s",
                       uid)
          env = [(k, v) for t in tools for (k, v) in t.environment.items()]
          env = ["{}=\"{}\"".format(k, v) for (k, v) in env]
          env = "\n".join(env)
          env_file = tempfile.NamedTemporaryFile(mode='w', suffix='.bugzoo.env')
          env_file.write(env)
          env_file.flush()
          self.__env_files[uid] = env_file
          logger.debug("created temporary environment file for container %s: %s",
                       uid, env_file.name)
  
          volumes = copy.deepcopy(volumes)
          volumes[env_file.name] = \
              {'bind': '/.environment.host', 'mode': 'ro'}
  
          # we copy the environment variables from the host machine, load them,
          # and save the complete set of environment variables to /.environment.
          # all future calls to the container will source the variables in
          # /.environment.
          cmd = (
              "sudo cp /.environment.host /.environment && "
              "sudo chown $(whoami):$(whoami) /.environment && "
              "source /.environment && "
              "sudo rm /.environment && "
              "export | sudo tee /.environment > /dev/null && "
              "sudo chmod 444 /.environment && "
              "echo 'BUGZOO IS READY TO GO!' && "
              "/bin/bash"
          )
          cmd = '/bin/bash -c "{}"'.format(cmd)
  
          logger.debug("creating Docker container for BugZoo container: %s", uid)  # noqa: pycodestyle
          dockerc = \
              self.__client_docker.containers.create(
                  bug.image,
                  cmd,
                  name=uid,
                  volumes=volumes,
                  volumes_from=tool_container_ids,
                  ports=ports,
                  network_mode=network_mode,
                  stdin_open=True,
                  tty=False,
                  # tty=interactive,
                  detach=True)  # type: docker.Container # noqa: pycodestyle
          self.__dockerc[uid] = dockerc
          logger.debug("created Docker container for BugZoo container: %s", uid)
          logger.debug("starting Docker container for BugZoo container: %s", uid)  # noqa: pycodestyle
          dockerc.start()
          logger.debug("started Docker container for BugZoo container: %s", uid)
  
          # block until /.environment is ready
          logger.debug("blocking until environment file has been constructed for container: %s", uid)  # noqa: pycodestyle
          ready = False
          output_startup = []  # type: List[str]
          for line in self.__api_docker.logs(dockerc.id, stream=True):
              line = line.decode('utf-8').strip()
              output_startup.append(line)
              if line == "BUGZOO IS READY TO GO!":
                  ready = True
                  break
          if not ready:
              response = indent(''.join(output_startup), 4)
              response = "[RESPONSE]\n{}\n[/RESPONSE]".format(response)
              response = indent(response, 2)
              msg = "failed to start Docker container, {}:\n{}"
              msg = msg.format(uid, response)
              logger.error(msg)
              raise Exception(msg)  # TODO add exception; DockerException, maybe?
          logger.debug("environment file has been constructed for container: %s", uid)  # noqa: pycodestyle
  
          container = Container(bug=bug.name,
                                uid=uid,
                                tools=[t.name for t in tools])
          self.__containers[uid] = container
          logger.debug("provisioned container for bug %s: %s",
                       bug.name, uid)
  
          logger.debug("STATUS OF CONTAINER: %s", dockerc.status)
          return container