我发现的所有 docker buildkit 示例都引用了一个创建的秘密 txt 文件,该文件传递给 build 命令。我在尝试使用的管理器节点上有一个秘密:
$docker inspect myreadonly
[
{
"ID": "zjrjyl0j7hf6s3whs5obhzl51",
"Version": {
"Index": 11
},
"CreatedAt": "2021-09-23T16:53:17.841157766Z",
"UpdatedAt": "2021-09-23T16:53:17.841157766Z",
"Spec": {
"Name": "myreadonly",
"Labels": {}
}
}
]
然后这就是我得到的:
$ DOCKER_BUILDKIT=1 docker build --progress=plain --secret id=myreadonly,src=/run/secrets/myreadonly --no-cache .
could not parse secrets: [id=myreadonly,src=/run/secrets/myreadonly]: failed to stat /run/secrets/myreadonly: stat /run/secrets/myreadonly: no such file or directory