我正在使用容器步骤在 Azure Devops yaml-pipeline 中运行 docker 映像。但是,我在安装存储库内容时遇到问题,以便可以从 docker 映像内部访问它。
Azure Devops pipeline.yml 文件如下:
container:
image: 'image-name'
endpoint: 'foo'
options: '-v $(Build.SourcesDirectory):/testing'
steps:
- script: echo Hello, world!
displayName: 'Run a one-line script inside docker image'
Run Code Online (Sandbox Code Playgroud)
此操作失败并显示错误消息:
Error response from daemon: create $(Build.SourcesDirectory): "$(Build.SourcesDirectory)" includes
invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended
to pass a host directory, use absolute path
Run Code Online (Sandbox Code Playgroud)
我还尝试替换$(..)$为$[..](请参阅此处,但这会导致相同的错误。此外,${{..}}管道甚至不会启动(错误:UI 中的“在此上下文中不允许使用模板表达式”)
如果我删除options脚本运行,但存储库未安装。 …