mirror of
https://github.com/yeasy/docker_practice.git
synced 2026-08-10 08:27:25 +00:00
fix(content): harden copy-paste safety examples
This commit is contained in:
@@ -158,9 +158,11 @@ RUN --mount=type=cache,target=/go/pkg/mod \
|
||||
|
||||
```docker
|
||||
RUN --mount=type=secret,id=mysecret \
|
||||
cat /run/secrets/mysecret
|
||||
my-private-tool --token-file /run/secrets/mysecret
|
||||
```
|
||||
|
||||
不要在构建命令中 `cat`、`echo` 或打印密钥内容;应把 `/run/secrets/<id>` 路径交给真正消费密钥的工具。
|
||||
|
||||
#### 3. Heredoc 语法
|
||||
|
||||
BuildKit 支持使用 heredoc 语法编写多行脚本,无需行末反斜杠 `\` 连接:
|
||||
|
||||
Reference in New Issue
Block a user