# 使用前端 dockerfile.v0 解决失败：读取 dockerfile 失败：解析 dockerfile 错误：未知指令：\

- **ID:** `docker/dockerfile-parse-error-line-continuation`
- **领域:** docker
- **类别:** build_error
- **验证级别:** ai_generated
- **修复率:** 88%

## 根因

Dockerfile 中用于续行的尾随反斜杠未正确转义或后跟空格，导致解析器将其视为指令。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Docker 24.0.7 | active | — | — |
| Docker 25.0.1 | active | — | — |

## 解决方案

1. ```
   确保反斜杠后没有尾随空格：将 'RUN apt-get update && \\n    apt-get install -y curl' 替换为使用单行或数组语法的正确格式。
   ```
2. ```
   使用 JSON 数组语法进行 RUN 以避免续行问题：'RUN ["apt-get", "update"]'。
   ```

## 无效尝试

- **** — Removing the backslash entirely breaks multi-line RUN commands, causing syntax errors in shell. (70% 失败率)
- **** — Adding more backslashes compounds the parsing error without fixing the root cause. (90% 失败率)
