Docker执行run命令提示‘invalid reference format’错误求助
Hey there, let's work through this Docker error you're hitting—those "invalid reference format" messages can be tricky, but I bet we can nail it down quickly.
First off, the most likely culprit in your command is incorrect dash characters: you're using long em dashes (—) for flags like —name and —rm, but Docker requires standard ASCII hyphens (-). This is a super common typo, especially if you copied the command from a formatted document or word processor that auto-replaces dashes.
Here's the fixed command with proper hyphens:
docker run --name my_app -it --rm -v "$(pwd):/service" nuadu_app python run_script/hello_world.py
If that doesn't resolve it right away, here are a few more checks to run:
- Verify that the image name
nuadu_appis valid: no spaces, unescaped special characters, and that the image actually exists on your local machine (or in a registry you have access to). - If you're on Windows using PowerShell, the
$(pwd)syntax might need adjustment—try${PWD}instead, or use a Linux-style path like/c/Users/your/pathfor the volume mount. - Double-check for accidental extra spaces in the command: sometimes a stray space can make Docker misinterpret part of your command as an invalid image reference.
Start with the corrected command first—that's almost certainly the fix here. Let me know if you still run into issues!
内容的提问来源于stack exchange,提问作者nexla

