Windows的Docker:卷为空 [英] Docker for Windows : volumes are empty

查看:105
本文介绍了Windows的Docker:卷为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我几周前从Windows 7更新到Windows 10:我正在使用Docker Toolbox / Virtual Box与Docker一起工作,并且我读到推荐使用Windows Docker(最新应用程序),但是要使其正常工作对我来说很痛苦



我使用hyperv创建了一个docker机器并运行docker hello-world works。



但是在使用卷时,会发生一个奇怪的行为:没有错误消息,容器运行正常,但是我的卷中没有文件,我只有文件夹。



我曾经在共享驱动器上遇到过麻烦,但是我设法使其正常运行(通过Docker for Win GUI)。



这是我尝试运行容器的命令,但是不映射Windows文件(仅映射文件夹):



docker run -ti -v文件夹/:数据/高山文件夹



我正在运行Docker版本18.03.0-ce



有什么想法吗?如果不清楚,请让我提供更多信息! Thx

解决方案

首先请确保您的驱动器已共享(见下图)。



一个重要说明是,如果您更改Windows密码,则将无法挂载共享驱动器。要解决此问题,只需取消共享并重新共享驱动器,或按重置凭据...。



感谢 ctliv 在此指出讨论:


I updated from Windows 7 to Windows 10 few weeks ago : I was using Docker Toolbox/Virtual Box to work with Docker and I read Docker for Windows was recommended (newest application) but it is a pain for me to make it work as it used to with Toolbox.

I created a docker machine using hyperv and running docker hello-world works.

But when it comes to use volumes, a strange behavior happens : No error messages, container working perfectly but my volume is empty of files inside, I only have folders.

I used to have troubles with Shared Drives but I managed to have it working (through Docker for Win GUI).

Here is a command I try which run a container but does not map Windows files (only folders) :

docker run -ti -v folders/:data/folder alpine

I am running Docker version 18.03.0-ce

Any idea? If I am not clear, please let me give more information! Thx

解决方案

First make sure that your drive is shared (see image below).

One important note is that if you change your windows password then your shared drives will not be able to mount. To fix this simply unshare and reshare your drive or press "Reset credentials...".

Thanks to ctliv for pointing that out in this discussion: https://github.com/docker/for-win/issues/25

这篇关于Windows的Docker:卷为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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