Dockerfile COPY {来源:-...}

Dockerfile COPY {source:-...}

当您在 Visual Studio 2017 中创建具有 Docker 支持的项目时,Docker 文件包含以下行:

COPY ${source:-obj/Docker/publish} .

这是什么意思?源宏指向哪里?破折号是什么意思?

也就是所谓的变量替换

英文翻译成这样:
"Hey Docker, when you build this, COPY the path you find the in $source variable in to the current directory in the image (.). If $source is empty or absent, just use the default path obj/Docker/publish"

$source是执行前定义的环境变量docker build.

部分参考资料: