Docker:如何在Windows 10中挂载当前目录 [英] Docker: How to mount current directory in Windows 10

查看:943
本文介绍了Docker:如何在Windows 10中挂载当前目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Windows 10 Home中使用docker toolbox v17.03。我正在使用来自python slim的flask应用程序。我试图将当前目录挂载到应用程序,并尝试$ {PWD}和%cd%如下所示。

I am using docker toolbox v17.03 in Windows 10 Home. I am playing with flask app from python slim. I tried to mount the current directory to app and tried ${PWD} and %cd% like below.

docker container run -it  -p 5000:5000 -e FLASK_APP=app.py --rm -e FLASK_DEBUG=1 -v %cd%:/app web1

==>出现错误提示无效字符

==> Got the error saying invalid characters

docker container run -it  -p 5000:5000 -e FLASK_APP=app.py --rm -e FLASK_DEBUG=1 -v ${PWD}:/app web1

==>错误或无效

推荐答案

第二种形式$ {PWD}为在Powershell会话中工作

The second form ${PWD} would be working in a Powershell session.

如果仍然显示无效字符 ,这意味着:

If it still says "invalid characters", that means:


  • %cd%不会被解析为绝对路径

  • 它包括 [a-zA-Z0-9] [a-zA-Z0-9 _.-] 中没有的字符,因此对于卷 name

  • the %cd% is not resolved as an absolute path
  • it includes characters that are not in [a-zA-Z0-9][a-zA-Z0-9_.-], making it inelligible for a volume name.

再次检查%cd%返回的内容,以及是否(或空格)中有任何特殊的非ASCII字符

Double-check what %cd% returns, and if there is any special non-ascii character in it (or spaces)

这篇关于Docker:如何在Windows 10中挂载当前目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆