#syntax=docker/dockerfile:experimental 是什么?
What is #syntax=docker/dockerfile:experimental?
我使用 dockerfiles 已经有一段时间了,但今天我在做一个小项目,不知何故在我的 VScode 我输入了 # 然后在第一行 CTRL+SPACE 我得到了这个syntax=docker/dockerfile:experimental
.
我不明白这是做什么的,也找不到关于它的文档,谁能解释一下那个奇怪的评论是怎么回事。
PS I found some people using this so it's not just some random comment generated by vscode I guess.
这是一种在使用 BuildKit 构建时在 Dockerfiles 中启用新语法的方法。它在 documentation:
中提到
Overriding default frontends
The new syntax features in Dockerfile are available if you override the default frontend. To override the default frontend, set the first line of the Dockerfile as a comment with a specific frontend image:
# syntax=<frontend image>, e.g. # syntax=docker/dockerfile:1.2
The examples on this page use features that are available in docker/dockerfile version 1.2.0 and up. We recommend using docker/dockerfile:1, which always points to the latest release of the version 1 syntax. BuildKit automatically checks for updates of the syntax before building, making sure you are using the most current version. Learn more about the syntax directive in the Dockerfile reference.
我已经用它来启用 SSH Auth Sock 转发。
我使用 dockerfiles 已经有一段时间了,但今天我在做一个小项目,不知何故在我的 VScode 我输入了 # 然后在第一行 CTRL+SPACE 我得到了这个syntax=docker/dockerfile:experimental
.
我不明白这是做什么的,也找不到关于它的文档,谁能解释一下那个奇怪的评论是怎么回事。
PS I found some people using this so it's not just some random comment generated by vscode I guess.
这是一种在使用 BuildKit 构建时在 Dockerfiles 中启用新语法的方法。它在 documentation:
中提到Overriding default frontends
The new syntax features in Dockerfile are available if you override the default frontend. To override the default frontend, set the first line of the Dockerfile as a comment with a specific frontend image:
# syntax=<frontend image>, e.g. # syntax=docker/dockerfile:1.2
The examples on this page use features that are available in docker/dockerfile version 1.2.0 and up. We recommend using docker/dockerfile:1, which always points to the latest release of the version 1 syntax. BuildKit automatically checks for updates of the syntax before building, making sure you are using the most current version. Learn more about the syntax directive in the Dockerfile reference.
我已经用它来启用 SSH Auth Sock 转发。