![](/img/trans.png)
[英]Docker: git operations not permitted in dir which is mounted from Win10's to container running ubuntu
[英]Mounting Win10 directory that has spaces and dashes in the path into Ubuntu Docker Container
我正在嘗試將 Windows 10 目錄安裝到 docker 上的 Ubuntu 容器中。 路徑名稱中包含空格和破折號:
C:\Users\eko\OneDrive - MyCo, Inc\_Git\covid19-maps
當我在 PowerShell 中運行以下命令時:
docker run -i -v C:/Users/eko/OneDrive\ -\ MyCo,\ Inc/_Git/covid19:/home/covid19 ubuntu:latest
Docker 失敗,出現unknown shorthand flag: '\\' in -\
我還嘗試了 escaping 帶有反斜杠的破折號,例如/OneDrive\ \-\ MyCo,\ Inc/_Git
但這也失敗了。
好的 - 不完全是問題的答案,但在 OneDrive 中擁有 git repo 是多余的。
我將它移到了問題較少的路徑上並且它起作用了。
docker run -i -v C:/_git/covid19:/home/git/covid19 ubuntu:latest
與 docker-compose 有一個非常相似的問題,使用卷:部分從 windows 服務器掛載 CIFS 共享,並帶有 windowsey 路徑和奇數字符。
這在 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.
解決方案:將整個卷指令用雙引號括起來
"/mnt/public/DRAWING\ LIBRARY/PRODUCT/1.\ New\ Number\ System\ \(1\ million\,\ T\ Camera\,\ Suppliers\ \&\ Pack\ Lists\)/:/host/documents/drawimgs-million-numbers"
奇跡般有效
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.