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

dockershell

docker run throws an "invalid reference format: repository name must be lowercase" error when using $(pwd) in the volume flag (-v). 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

Best Answer

For my own circumstance, the output of pwd contained a directory with a space (i.e. /something/Problematic Directory/something-else). This was resolved by wrapping $(pwd) in quotation marks to explicitly identify it as a string:

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.

Related Topic