I built a Dokerfile, created an image, and ran a docker run.
The following error cannot be resolved:
docker: invalid reference format.
See'docker run --help'.
When I looked into it, I looked at the article that caused the copy source and destination path to be written after -v
I tried the following pattern, but all of the above error messages appear.
If you know how to solve this problem, please let me know.
C:/PC-Work/dockerevenv
docker container run-it -- name sample-python-v${PWD}/ex01:/tmp/mydir/sample/python:latest
docker container run-it --name sample-python-v C:\PC-Work\dockereenv\ex01:/tmp/mydir/sample/python:latest
docker container run-it -- name sample-python-v "${PWD}/ex01/:/tmp/mydir"/sample/python:latest
docker container run-it -- name sample-python-v "C:\PC-Work\dockereenv\ex01:/tmp/mydir"/sample/python:latest
Docker for Windows × volume option × path specification, depending on what is verified in , the string given to -v
is
-v "C:\test":/test
-v "C:/test":/test
-vC:/test:/test
All of them will be successful.(I haven't tried it yet, so I don't know if this result is correct.)
However, this is the result of the verification at the command prompt (cmd.exe
), and PowerShell shows a different behavior.for Shell generally interprets and makes changes to the arguments.You can see them by typing cmd/cecho
followed by to see how they are interpreted
cmd.exe
)C>cmd/cecho-v "C:\test":/test
-v "C:\test": /test
C>cmd/cecho-v "C:/test":/test
-v "C:/test": /test
C>cmd/cecho-v C:/test:/test
- vC: /test: /test
→In the range we tried here, the input string will be passed directly to the program.
PS>cmd/cecho-v "C:\test":/test
- vC:\test:/test
PS>cmd/cecho-v "C:/test":/test
- vC: /test: /test
PS>cmd/cecho-vC:/test:/test
- vC: /test: /test
→"
will be deleted and a blank space will be inserted.
To be interpreted and not rewritten by PowerShell, a PowerShell specification escape is required and the input is as follows:
PS>cmd/cecho-v`"C:\test`":/test
-v "C:\test": /test
→ Escape "
with backquote.
PS>cmd/cecho-v`"C:/test":/test`
-v "C:/test": /test
→ Tie the string containing "
with a single quote '
.
Based on the above, would the following be an example of typing on a PowerShell?
docker container run-it --name sample-python-v`"C:\PC-Work\dockereenv\ex01`":/tmp/mydir/sample/python:latest
→Escape with a back quote while tying it with "
.The path delimiter can be /
\
.
docker container run-it -- name sample-python-v' "C:\PC-Work\dockereenv\ex01": /tmp/mydir'/sample/python:latest
→ Escape the string with '
while tying it with "
.The path delimiter can be /
\
.
docker container run-it -- name sample-python-v C:/PC-Work/dockereenv/ex01:/tmp/mydir/sample/python:latest
→ Use /
as the path delimiter and do not quote.
916 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
582 PHP ssh2_scp_send fails to send files as intended
578 Understanding How to Configure Google API Key
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.