def ignore_escape(path: str) -> str:
    """
    Escape a path appropriately for a docker ignore file.
    """
    special_chars = "\\*?[]"
    return "".join("\\" + ch if ch in special_chars else ch for ch in path)