def execute_local_docker(self, image, *, root="build", docker_args=[]):
        """
        Execute build plan inside a Docker container. Files from the build plan are placed in the
        build root directory ``root`` on the local filesystem. This directory is bind mounted to
        ``/build`` in a container and the script ``{script}.sh`` is executed inside it.
        ``docker_args`` is a list containing additional arguments to docker.

        Returns :class:`LocalBuildProducts`.
        """
        build_dir = self.extract(root)
        container_name = f"amaranth_build_{random.randbytes(8).hex()}"
        try:
            subprocess.check_call([
                "docker", "run", *docker_args,
                "--rm", # remove the container after running
                "--init", # run an init process as PID 1. Helps exit faster
                "--name", container_name,
                "--mount", f"type=bind,source={build_dir},target=/build",
                "--workdir", "/build",
                image,
                "sh", f"{self.script}.sh",
            ])
        except KeyboardInterrupt:
            subprocess.check_call([
                "docker", "stop", container_name
            ], stdout=subprocess.DEVNULL)
        return LocalBuildProducts(build_dir)

        Execute build plan inside a Docker container. Files from the build plan are placed in the
        build root directory ``root`` on the local filesystem. This directory is bind mounted to
        ``/build`` in a container and the script ``{script}.sh`` is executed inside it.
        ``docker_args`` is a list containing additional arguments to docker.

        Returns :class:`LocalBuildProducts`.
        
amaranth/build/run.py