简体   繁体   English

docker run使用卷标志中的$(pwd)抛出“无效的引用格式:存储库名称必须为小写”

[英]docker run throws “invalid reference format: repository name must be lowercase” using $(pwd) in volume flag

docker run throws an "invalid reference format: repository name must be lowercase" error when using $(pwd) in the volume flag ( -v ). 在卷标志( -v )中使用$(pwd)时, docker run会抛出“无效的引用格式:存储库名称必须为小写”错误。 This is the command that is currently causing the issue: 这是当前导致问题的命令:

docker run --rm -v $(pwd)/app/polymer:/home/polymer/app jefferyb/polymer-cli polymer build

For my own circumstance, the output of pwd contained a directory with a space (ie /something/Problematic Directory/something-else). 对于我自己的情况, pwd的输出包含一个带空格的目录(即/ something / Problematic Directory / something-else)。 This was resolved by wrapping $(pwd) in quotation marks to explicitly identify it as a string: 通过将$(pwd)包装在引号中以明确地将其标识为字符串来解决此问题:

docker run --rm -v "$(pwd)/app/polymer":/home/polymer/app jefferyb/polymer-cli polymer build

The documentation I read didn't use quotation marks, however this might be better practise when using variable interpolation in shell to avoid these kind of issues. 我读过的文档没有使用引号,但是在shell中使用变量插值来避免这些问题时,这可能是更好的做法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM