简体   繁体   English

使用Docker安装卷 - 没有添加文件

[英]Mounting Volume Using Docker - No Files Being Added

I am trying to mount a volume using docker command on WSL (Bash). 我试图在WSL(Bash)上使用docker命令挂载卷。 But the files and folders I need to mount do not show up to Docker, hence, when I run the docker command it says file not found. 但是我需要挂载的文件和文件夹不会显示给Docker,因此,当我运行docker命令时,它说文件未找到。

I am trying to simply use the Alpine Container to see if I can make it work. 我试图简单地使用Alpine Container来看看我是否可以使它工作。 But it also fails to recognize all the files/folders I have on the dir I run it on. 但它也无法识别我在目录上运行它的所有文件/文件夹。

The following command: 以下命令:

docker run --rm -v /c/Users/alexandrec/Desktop/AWS_Layers/pandas:/data alpine ls /data

Returns: 返回:

test

And this command: 这个命令:

/mnt/c/Users/alexandrec/Desktop/AWS_Layers/pandas$ ls -la

Returns: 返回:

-total 2238
-drwxrwxrwx 0 root root 512 May 29 15:22 .
-drwxrwxrwx 0 root root 512 May 29 14:56 ..
-rwxrwxrwx 1 root root 254 May 28 16:52 get_layer_packages.sh
-rwxrwxrwx 1 root root  85 May 29 11:31 my_module.py
-drwxrwxrwx 0 root root 512 May 29 15:22 New folder
-drwxrwxrwx 0 root root 512 May 28 16:49 python
-rwxrwxrwx 1 root root  28 May 28 14:56 requirements.txt
-drwxrwxrwx 0 root root 512 May 29 14:56 test
-drwxrwxrwx 0 root root 512 May 28 20:30 var

Somehow most folders/files in the DIR do not get mounted only test . 不知何故,DIR中的大多数文件夹/文件都没有安装仅test

Eventually I want to be able to run this: 最终我希望能够运行这个:

docker run --rm -v "$PWD":/var/task lambci/lambda:python3.6 my_module.my_handler

Which currently returns: 目前返回的是:

START RequestId: d3df9063-56ea-4c56-b097-2932c633d74f Version: $LATEST
Unable to import module 'my_module': No module named 'my_module'
END RequestId: d3df9063-56ea-4c56-b097-2932c633d74f
REPORT RequestId: d3df9063-56ea-4c56-b097-2932c633d74f Duration: 0 ms Billed Duration: 100 ms Memory Size: 1536 MB Max Memory Used: 19 MB

{"errorMessage": "Unable to import module 'my_module'"}

I just don't seem to figure out if this is a permission problem or something related to Windows/Docker/Linux interactions. 我似乎并不知道这是一个权限问题还是与Windows / Docker / Linux交互相关的问题。

The following link shows my bash terminal commands: https://imgur.com/4tqpdaR 以下链接显示了我的bash终端命令: https//imgur.com/4tqpdaR

Okay, it was due to the Windows Credentials, they needed to be updated. 好的,这是由于Windows凭据,他们需要更新。 In the Docker App, Settings -> Shared Drives -> Reset Credentials 在Docker应用程序中,设置 - >共享驱动器 - >重置凭据

Run as Administrator just to make sure. 以管理员身份运行以确保。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM