[英]Mounting Win10 directory that has spaces and dashes in the path into Ubuntu Docker Container
I am trying to mount a Windows 10 directory into an Ubuntu container on docker.我正在尝试将 Windows 10 目录安装到 docker 上的 Ubuntu 容器中。 The path has spaces and a dash in the name:
路径名称中包含空格和破折号:
C:\Users\eko\OneDrive - MyCo, Inc\_Git\covid19-maps
When I run the following in PowerShell:当我在 PowerShell 中运行以下命令时:
docker run -i -v C:/Users/eko/OneDrive\ -\ MyCo,\ Inc/_Git/covid19:/home/covid19 ubuntu:latest
Docker fails with unknown shorthand flag: '\\' in -\
Docker 失败,出现
unknown shorthand flag: '\\' in -\
I also tried escaping the dash with a backslash like so /OneDrive\ \-\ MyCo,\ Inc/_Git
but that also fails.我还尝试了 escaping 带有反斜杠的破折号,例如
/OneDrive\ \-\ MyCo,\ Inc/_Git
但这也失败了。
Ok - not exactly an answer to the question, but having the git repo in OneDrive was redundant.好的 - 不完全是问题的答案,但在 OneDrive 中拥有 git repo 是多余的。
I moved it to a less problematic path and it worked.我将它移到了问题较少的路径上并且它起作用了。
docker run -i -v C:/_git/covid19:/home/git/covid19 ubuntu:latest
had a very similar problem with docker-compose, using the volumes: section to mount a CIFS share from a windows server, complete with windowsey paths and odd characters.与 docker-compose 有一个非常相似的问题,使用卷:部分从 windows 服务器挂载 CIFS 共享,并带有 windowsey 路径和奇数字符。
This looked fine in VSC, no problems reported, but when I ran docker-compose up, I got very weird errors:这在 VSC 中看起来不错,没有报告任何问题,但是当我运行 docker-compose 时,我得到了非常奇怪的错误:
Creating e3-ui ... error
kdir /mnt/public/DRAWING\ LIBRARY: invalid argument
ERROR: for viewer-app Cannot start service viewer-app: error while creating mount source path '/mnt/public/DRAWING\ LIBRARY/PRODUCT/1.\ New\ Number\ System\ \(1\ million\,\ T\ Camera\,\ Suppliers\ \&\ Pack\ Lists\)': mkdir /mnt/public/DRAWING\ LIBRARY: invalid argument
ERROR: Encountered errors while bringing up the project.
The solution: wrap the entire volume directive in double-quotes解决方案:将整个卷指令用双引号括起来
"/mnt/public/DRAWING\ LIBRARY/PRODUCT/1.\ New\ Number\ System\ \(1\ million\,\ T\ Camera\,\ Suppliers\ \&\ Pack\ Lists\)/:/host/documents/drawimgs-million-numbers"
Works like a charm奇迹般有效
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.