简体   繁体   English

将路径中有空格和破折号的 Win10 目录挂载到 Ubuntu Docker 容器中

[英]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 路径和奇数字符。

  • /mnt/public/DRAWING\ LIBRARY/PRODUCT/1.\ New\ Number\ System\ (1\ million,\ T\ Camera,\ Suppliers\ &\ Pack\ Lists)/:/host/documents/drawimgs-million-numbers /mnt/public/DRAWING\LIBRARY/PRODUCT/1.\New\Number\System\(1\million,\T\Camera,\ Suppliers\ &\ Pack\ Lists)/:/host/documents/drawimgs-million-数字

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.

相关问题 Docker:在从 Win10 安装到运行 ubuntu 的容器的目录中不允许进行 git 操作 - Docker: git operations not permitted in dir which is mounted from Win10's to container running ubuntu 在 Windows KVM 实例中运行 Win10 Docker 容器时出错 - Error running Win10 Docker container in Windows KVM instance 如何在 Virtualbox (Ubuntu) 中运行 Docker 并在 Win10 主机上使用它 - How to run Docker inside Virtualbox (Ubuntu) and use it on Win10 host Docker ERROR:从Win10运行时找不到容器命令或不存在容器命令 - Docker ERROR: Container command not found or does not exist when running from Win10 将网络文件夹挂载到 Windows 10 上的 Docker 容器 - Mounting a network folder to a Docker container on Windows 10 Vagrant 2.2 on Win10错误在提供程序“ docker”上 - Vagrant 2.2 on Win10 Error on Provider “docker” 关于Win 7和Win10的pTreads - pThreads on Win 7 and Win10 Win10:在 PATH 变量中使用符号链接 - Win10: Using symbolic links in the PATH variable 无法 map 将带有空格的主机目录连接到容器目录(绑定挂载) - Docker 快速入门终端(Bash),windows 10 - Cannot map a host directory with spaces to a container directory (bind mounts) - Docker Quickstart Terminal (Bash), windows 10 DBD-Oracle(1.74 或 1.76)与 oracle Instantclient 11.2 on win10 wsl ubuntu - DBD-Oracle (1.74 or 1.76) with oracle instantclient 11.2 on win10 wsl ubuntu
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM